My program takes a checkboxed item and depending on the serial number that is present on the item on the invoice, subtracts one from the amount list I have the following in a listview on a details page which I added with the following code:
Item - Low Socks(pink)
Serial # - 34-75-860
Price - 5.89
Amount - 12
排在栏目中,而不是上列。
Dim items As New ListViewItem
items = ListView1.Items.Add("Low Socks(Pink)")
items.SubItems.Add("34-75-860")
items.SubItems.Add("$5.89")
items.SubItems.Add("12")
items = ListView1.Items.Add("Low Socks(Black)")
items.SubItems.Add("34-75-900")
items.SubItems.Add("$5.89")
items.SubItems.Add("25")
items = ListView1.Items.Add("Low Socks(Red)")
items.SubItems.Add("34-75-756")
items.SubItems.Add("$5.89")
items.SubItems.Add("10")
items = ListView1.Items.Add("Low Socks(Orange)")
items.SubItems.Add("34-75-234")
items.SubItems.Add("$5.89")
items.SubItems.Add("34")
items = ListView1.Items.Add("Low Socks(Blue)")
items.SubItems.Add("34-75-598")
items.SubItems.Add("$5.89")
items.SubItems.Add("23")
End Sub
根据我的发票页,我在发票上的物品旁边有支票箱。 当检查箱被点击时,我想要减少一个。 我稍后将讨论这个问题,并将之改变为它所需要的实际数额,取决于他们订购的那项物品的多少。
Dim item As ListViewItem
Dim i As Integer
Dim count As Integer
count the number of items in itemdetails2 listview
count = ItemDetails2.ListView1.Items.Count - 1
loop to read each item in the list
For i = 1 To count
If i > count Then Exit For
item = ItemDetails2.ListView1.Items(i)
compare the item to the serial number
If item.Checked = True Then
If (item.SubItems(0).Text = "34-75-860") Then
item.SubItems(2).Text -= 1
End If
i = i + 1
count = count - 1
End If
Next
ItemDetails2.Show()
End Sub
Right now it doesn t look like it does anything. I have tried changing my index s on my subitems to 1 and 3 instead of 0 and 2 but i figured because they are subitems that they need to be subitem index 0 and subitem index 2 since there is one item and three subitems to that one item. if that makes sense.... please help.