Hi :) basically i have a Checked ListViewBox (i selected "checked = true" in the properties section). I need to be able to get data from the checked items/rows in the listViewBox to calculate a total price in a text box. I have a combo box where you can select what file you want to be displayed in the ListViewBox (so the lvwbox can alternate between 3 different files but i can solve this using a simple If Statement - If cboDate = "....." Then.....etc. so it's not a problem)
I'll post a screenshot of my form on here so it makes more sense but basically, i need to code something that lets me select multiple items in the ListViewBox and then displays a total price based on those selections (btw each item in the Box has a different price)
The file names are JuneEvent, JulyEvent and AugEvent and each one has several record fields which are ClassID, ClassDescripion, ClassTime and ClassPrice.
I've been stuck on this for ages can someone please help me! thanks lol :P
p.s Currently the only code i have on the form is to display a certain file in the ListViewBox based what is selected in the combo box...
Click here to see the screenshot of program form
Here is the form in action - ignore the table on the right hand side - i'll deal with that later
EDIT: RECENT CODE:
Private Sub lvwEvents_ItemChecked(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckedEventArgs) Handles lvwEvents.ItemChecked
Dim totalAmt As Double = 0
For Each lv As ListViewItem In lvwEvents.Items
If lv.Checked = True Then
totalAmt += JuneEvent.ClassPrice
End If
Next
txtPrice.Text = FormatNumber(totalAmt, 2)
End Sub
Since you don't have a code posted for us to study, I'll just add here the code that will do what you need to do. I hope you can use it as your reference.
I assume here that ListView1.Items(0).Text is the amount to be summed.