VB.NET Program Questions

Discussion in 'Programming' started by Internal09, Jul 22, 2012.

  1. #1
    Hello below is Screen Shot of my program I am making for a friends service.

    [​IMG]

    What I am trying to do is load up the clients and sort them by the date they were added as well as add up the total bill, sale, and commission which will show up in the text labels under the Statistics group box.

    Here is what I have so far.
    Also you may notice I used the same function multiple times because I have 3 buttons that do the same exact thing, I know it sounds ridiculous but the extra buttons came with the DotNetBar UI.
    http://pastebin.com/NbBVFKy1
    Code (markup):
    EDIT: I got this IComparer Class

    Public Class MyComparer : Implements IComparer
        Private Col As Integer
        Sub New(ByVal ColumnInt As Integer)
      Col = ColumnInt
        End Sub
    
        Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements IComparer.Compare
      'Return New CaseInsensitiveComparer().Compare(x.SubItems(0).Text, y.SubItems(0).Text)
      Dim LVIx As ListViewItem = DirectCast(x, ListViewItem)
      Dim LVIy As ListViewItem = DirectCast(y, ListViewItem)
      Return LVIx.SubItems(Col).Text.CompareTo(LVIy.SubItems(Col).Text)
        End Function
    End Class
    Code (markup):
    But I am not sure how I can use it to sort it by the datetimepicker.

    Private Sub SortLVItems()
        Dim ColumnToSort As Integer = 1
        ListView1.ListViewItemSorter = New MyComparer(ColumnToSort)
        ListView1.Sort()
        ListView1.ListViewItemSorter = Nothing
    End Sub
    Code (markup):
    It would be helpful if anyone can refer me to some resources or sites.
     
    Internal09, Jul 22, 2012 IP