P
Peter Mancini
I have a simple winform with a listbox on it. I dynamically load the
box with integers (the years 1975 to present.) This works fine and I
can see the box has all of the items present. I then do a
mylistbox.SetSelected(0,true) so that the first item starts off
selected. It is a MultiSimple listbox. What happens is nothing. The
form draws and the listbox has the list of years but nothing is
selected. I do the selection in the MainForm() constructor.
Here's another odd bit. If I poke the listbox then it works and the
selection is fine. Thus if I follow up the SetSelected with:
int Kludge=mylistbox.SelectedItems.Count;
then it works. I've tried doing mylistbox.invalidate(),
mylistbox.refresh() and a couple of other things with no success. Am I
calling the SetSelected in the wrong place? If not, what would the
right place to add it be?
Thanks!
--Pete
box with integers (the years 1975 to present.) This works fine and I
can see the box has all of the items present. I then do a
mylistbox.SetSelected(0,true) so that the first item starts off
selected. It is a MultiSimple listbox. What happens is nothing. The
form draws and the listbox has the list of years but nothing is
selected. I do the selection in the MainForm() constructor.
Here's another odd bit. If I poke the listbox then it works and the
selection is fine. Thus if I follow up the SetSelected with:
int Kludge=mylistbox.SelectedItems.Count;
then it works. I've tried doing mylistbox.invalidate(),
mylistbox.refresh() and a couple of other things with no success. Am I
calling the SetSelected in the wrong place? If not, what would the
right place to add it be?
Thanks!
--Pete