loop problem

newbeginner

New member
Joined
Nov 1, 2007
Messages
2
Programming Experience
Beginner
I want to ask if I have a listview with 3 colmuns (qty, food, price) and a label to show the total price

listview:some items like
-----------------
1__ice cream ____2.55
_____with cone_____0.50
2__pizza ________5.55
_____with onion ____0.50
_____with ham _____ 0.50
_____with pina apple_0.50
3__coke__________6.75
_____with out ice
-----------------
What I want to do is if I click the food's name on the listview to remove that item then request item ("with ........")will also follow to remove
I type on LV1 click event:
VB.NET:
Expand Collapse Copy
    Dim kia As ListViewItem = Form1.ListView2.SelectedItems(0)
        Dim totalprice As Double = Form1.Label1.Text
        Select Case kia.SubItems(1).Text
            Case "1"              
                Dim place As Integer = kia.Index
                Dim newitem As New ListViewItem
                'Here                
                If newitem.Index = place + 1 And Microsoft.VisualBasic.Left (newitem.Text, 4) = "with"  Then
                Form1.Label1.Text = (totalprice - newitem.SubItems(2).Text)
                newitem.Remove()
                End If
                'Here 
                Form1.Label1.Text = (totalprice - kia.SubItems(2).Text)
                kia.Remove()            
            Case Is > 1
                Dim rate As Double = kia.SubItems(2).Text / kia.SubItems(1).Text
                Form1.Label1.Text = (totalprice - rate)
                kia.SubItems(1).Text = kia.SubItems(1).Text - 1
                kia.SubItems(2).Text = kia.SubItems(2).Text - rate
               
            Case Nothing
                Form1.Label1.Text = (totalprice - kia.SubItems(2).Text)
                kia.Remove()
        End Select

    End Sub
the problem is between two ('Here) is not work, can anyone help me please
 
Last edited:
Back
Top