if the itemcheck is check then all the checks will be add separately to cash... i hope is it clear enough... thank You.. God bless...
Dim Cash As Double = 0.0
Dim Cheque As Double = 0.0
Dim Other As Double = 0.0
Dim DetermineCash As Boolean
Dim CheckedItems As ListView.CheckedListViewItemCollection = LstvwBankDeposits.CheckedItems
Dim Item As New ListViewItem
For Each Item In CheckedItems
If (Item.SubItems(4).Text) = "Check" Then
DetermineCash = False
Cheque += Double.Parse(Item.SubItems(3).Text)
ElseIf (Item.SubItems(4).Text) = "Cash" Then
DetermineCash = True
Cash += Double.Parse(Item.SubItems(3).Text)
End If
Next
If LstvwBankDeposits.Items(1).SubItems(4).Text = "Cash" Then
DetermineCash = True
If e.CurrentValue = CheckState.Unchecked Then
Cash += Double.Parse(Me.LstvwBankDeposits.Items(e.Index).SubItems(3).Text)
ElseIf e.CurrentValue = CheckState.Checked Then
Cash -= Double.Parse(Me.LstvwBankDeposits.Items(e.Index).SubItems(3).Text)
End If
ElseIf LstvwBankDeposits.Items(1).SubItems(4).Text = "Check" Then
DetermineCash = False
If e.CurrentValue = CheckState.Unchecked Then
Cheque += Double.Parse(Me.LstvwBankDeposits.Items(e.Index).SubItems(3).Text)
ElseIf e.CurrentValue = CheckState.Checked Then
Cheque -= Double.Parse(Me.LstvwBankDeposits.Items(e.Index).SubItems(3).Text)
End If
End If
If DetermineCash = True Then
LblTotalCash.Text = CType(Cash, String)
LblTotalCash.Text = FormatNumber(LblTotalCash.Text, 2)
DetermineCash = False
ElseIf DetermineCash = False Then
LblTotalChecks.Text = CType(Cheque, String)
LblTotalChecks.Text = FormatNumber(LblTotalChecks.Text, 2)
DetermineCash = True