Hello again
Thank u for your kind helps
again i have a question
my problem is this
i have a program with 3 list boxes
when user choose an Item in one list box that item in parallel list boxes must also be chosen
here is an example

Quantity..... Name......Price

1 ............... pizza ...... 5
2.................coke ........1


when user clicks on the Pizza, number 1 and 5 must be selected too.
I don't know how to related them..

If the items in the three listboxes share the same index, you can use the SelectedIndex property.

If listbox2.SelectedIndex > -1 Then
   listbox1.SelectedIndex = listbox2.SelectedIndex
   listbox3.SelectedIndex = listbox2.SelectedIndex
End If

If the items in the three listboxes share the same index, you can use the SelectedIndex property.

If listbox2.SelectedIndex > -1 Then
   listbox1.SelectedIndex = listbox2.SelectedIndex
   listbox3.SelectedIndex = listbox2.SelectedIndex
End If

oh yes that's right, tnx
i was using Item instead of index
can you tell me why should i put that condition in the code?

Well. That's a "just in case" scenario.
If you happen to put the code another event than the listbox's SelectedIndexChanged event, it would be useful to have that just in case no item has been selected from the second listbox.

thank u so much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.