Statsar Statistics Library

v1.0.1 for .NET

Product Guide



More Information...

Valid XHTML


Sort Data Example (VB.NET)

[VB.NET]
' COPYRIGHT(C), SIMPLEXAR SOFTWARE LIMITED, 2006-2008.
' All rights reserved.
'
' Use of this copyright notice is precautionary only, and does not imply
' publication or disclosure. The content of this work contains confidential
' and proprietary information of Simplexar Software Limited. Any duplication,
' modification, distribution, or disclosure in any form, in whole, or in part,
' is strictly prohibited without express prior written permission.

' Get namespaces.
Imports System
Imports Simplexar.Statsar

' Start namespace.
Namespace Simplexar.Examples.Statsar

    ' This example uses the DataSheet.Sort method to sort a data sheet.
    ' Data is sorting according to multiple columns in both ascending
    ' and descending orders.
    Module Example

        ' The application entry point.
        Public Sub Main()
            Try
                RunExample()
            Catch exception As Exception
                Console.WriteLine(exception)
            End Try
            Console.WriteLine("Press ENTER to terminate.")
            Console.ReadLine()
        End Sub

        Private Sub RunExample()

            ' Create a calculator.
            Dim calculator As New StatsCalculator()

            ' Use the calculator to load the sheet.
            Dim sheet As DataSheet = calculator.Load( _
                "..\..\..\..\..\Data\ExamResults.csv")
            Console.WriteLine(sheet)

            ' Sort by first name.
            sheet.Sort("FirstName")
            Console.WriteLine(sheet)

            ' Sort by age descending then by english result ascending.
            sheet.Sort( _
                New String() {"Age", "EnglishResult"}, _
                New SortOrder() {SortOrder.Descending, SortOrder.Ascending})
            Console.WriteLine(sheet)

        End Sub

    End Module

End Namespace