Click here to Skip to main content
15,921,837 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want when the textbox text equals listbox1 selected items then a msg box will appear
here is what the code looks like:

If ListBox1.SelectedItems.Equals(TextBox2.Text) Then
MsgBox("hello", MsgBoxStyle.Information,"HELLO")
WebBrowser1.GoBack()
End If

Thanks
Posted

Is this VB6, or VB.Net. You have to be more specific.

Assuming it's VB.Net, you want to used

if ListBox1.SelectedItem.ToString() = TextBox2.Text Then...


If it's a multi-aselect listbox, you need to iterate through the selected items, something like this:

foreach item as object in ListBox1.SelectedItems
    if (item as string =TextBox2.Text) Then... 


Go forth, and code.
 
Share this answer
 
v2
This will do it.

VB
If ListBox1.SelectedItem =TextBox2.Text Then
MsgBox("hello", MsgBoxStyle.Information,"HELLO")
WebBrowser1.GoBack()
End If
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900