Greetings,
I am busy developing an application which has two listboxes containing two variations of the same data.
I need to be able to keep the selected items synchronized.
Both listboxes must have the same item selected at the same time.
I need the two items to be selected next to each other.
The other problem is that I need to scroll the listboxes together.
Both when scrolling down and then across.
Does anyone out there have any ideas, or hopefully samples, to achieve this?
Thanks in advance,
zaroblan
Keeping two listboxes synchronized
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vimal KandasamyRank #2,151 · 661 reputationPosted Mar 11, 2009, 8:37 PM EDT
hi...
for listbox synchronization...
add following code
private void listbox1_selectedIndexChanged(Object sender,EventArgs e)
{
listBox2.SelectedIndex=listBox1.SelectedIndex;
}
private void listbox2_selectedIndexChanged(Object sender,EventArgs e)
{
listBox1.SelectedIndex=listBox2.SelectedIndex;
}
when u run this code..if one listbox item gets selected then same item in other listbox will be selected...
when u scroll down & select an item in one list box then.. another listbox is also getting scrolled and select same item..try this.. it may help u...
fernando ingunza12 reputationPosted Jan 25, 2013, 4:31 AM EST
fernando ingunza12 reputationPosted Jan 25, 2013, 4:31 AM EST