Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21297

Check If Item Is In Listboxes Using Do While Loops

$
0
0
I need a code that:
Displays text in a label if item is in list box 1
Displays different text if item is in list box 2
And displays different text if item is in neither


Heres what i came up with, but the label only shows the text if item is in listbox 1:

Dim i As Integer = 0
Dim listsize As Integer = ListBox1.Items.Count
Dim listsize2 As Integer = ListBox2.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
Label1.Text = "$20"
End If
i += 1
Loop


thanks for the help!

Viewing all articles
Browse latest Browse all 21297

Trending Articles



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