P
P
Peter2017-10-01 20:40:32
C++ / C#
Peter, 2017-10-01 20:40:32

How to implement the same selection in two ListBoxes?

Good afternoon. I have two listboxes on a form with the same number of rows. 10 in one and 10 in the other.
How to make it so that, say, selecting the 8th element in the first Listbox, the 8th element in the second Listbox is automatically selected? The use of if () came to mind, but with a large number of elements, a very long piece comes out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bashinsky, 2017-10-02
@Morpheus_God

Subscribe to the SelectedChanged event like this is called and in it at the second sheet do this:
list2.SelectedIndex = list1.SelectedIndex;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question