Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

Check if Items are in a List Box Using Do While Loops

$
0
0
I need a code that using a do while loop will display a message if:
the text is in list box 1
the text is in list box 2
or the text is in neither list boxes

this is the code i came up with, but it only works if te\he item is in list box 1:
Dim i As Integer = 0
Dim listsize As Integer = FifteenListBox.Items.Count
Dim listsize2 As Integer = TwentyListBox.Items.Count
Dim zipcode As Integer= ZipTextBox.Text


Do While (i < listsize - 1)
Do While (i < listsize - 1)
If (ListBox1.Items(i) = zipcode) Then
Label1.Text = "$15"
End If
i += 1
Loop
Loop

Do While (i < listsize2 - 1)
If (ListBox2.Items(i) = zipcode) Then
Label2.Text = "$20"
End If
i += 1
Loop

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>