how do i make it say that on form load, the first item in the listbox is selected?
+2
A:
Hi you can use the SelectedIndex Property of listbox for eg.
listbox1.selectedindex = 0
The default behaviour is that selectedindex is set to 0. Which would be the first item in the list.
CAbbott
2009-06-10 16:21:09
selectedindex = 1 will select the 2nd item in the list. 0-based indexing.
TheTXI
2009-06-10 16:32:15
A:
As far as I know the first item is always selected if no other item is assigned to be. If you want to reset it back to the first item to be selected, a better approach in my opinion is:
listbox1.ClearSelection()
Joop
2009-06-10 16:24:07
+2
A:
Using of the selected indix is the best way - listbox1.selectedindex = 0 (since it is a 0 based collection)
Bhaskar
2009-06-10 16:26:33