Avatar of KzKrew
KzKrew
Flag for United States of America asked on

Calculated Values in VB ListView Groupings

I am using a ListView to view data from a MySqlDB. 

ListView name is lstMySqlData -- I am able to pull in the data from MySql into the ListView -- then sort into Groups using the Sub code below by calling sub using the following: GroupByEmpNo(lstMySqlData, 1)

See resulting screen shot below:

My question is how to calculate the Claim Diff field by group as shown. The first row of each group would be the time in 100ths since midnight. Each row after that would be the amount of time since the last punch.

Thoughts -- example code -- other

Thanks for your help

Dan


    Public Sub GroupByEmpNo(ByVal lstV As System.Windows.Forms.ListView, ByVal SubItemIndex As Int16)
        Dim flag As Boolean = True
        For Each l As ListViewItem In lstV.Items             Dim strmyGroupname As String = l.SubItems(SubItemIndex).Text             For Each lvg As ListViewGroup In lstV.Groups                 If lvg.Name = strmyGroupname Then                     l.Group = lvg                     flag = False                 End If             Next             Dim BackColor             BackColor = "FDF5E6"             For Each g As ListViewGroup In lstV.Groups                 With g                     For Each i As ListViewItem In .Items                         i.Font = New Font("Calibri", 10, FontStyle.Bold)                         i.BackColor = Color.Wheat                     Next                 End With             Next             If flag = True Then                 Dim lstGrp As New ListViewGroup(strmyGroupname, strmyGroupname)                 lstV.Groups.Add(lstGrp)                 l.Group = lstGrp             End If             flag = True         Next     End Sub

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment
louisfr

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
louisfr

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61