Ok, I know the problem (difference between SelectionMode “One” and “MultiSimple”).
The problem is that my function to fill the ListBox is in the “Load” event of my form… maybe is the time to draw the selection.
Curiously the “One” work in the Load event, but not “MultiSimple”.
If I put a button for select the item, this works.
If I put a timer for select the item (in the Load event), this works…. (This will be my solution for now).
You can try, also is the same problem in your attached code.
I’m not sure I understand. From the code you posted looks like you are adding a ListViewItem objects to a ListBox and when you select the item it doesn’t work? Or are you adding the items to a ListView and try to select the in a ListBox? You can’t select an item in the ListBox and expect to see it selected also in the ListView.
I tried a small sample and it all works fine – If I understood what you are trying to do. If you attach a small sample we can make sure we are looking at the same thing.
The example creates 5 ListViewItem instances and adds them to a ListView and to a ListBox. Selecting the index (listiew) or item (listbox) works well. Selecting in one control will *not* affect the other control, which is also correct.
Is an “ListItem”.
But not… the selection dynamically is not working.
I tried everything..
After i add all my items to listview…
ListBox.SelectedIndex = 52
And ListBox.SelectedItem = vSel (my item object)
Please login first to submit.