If I have a multiselectable listbox...
How do you programmatically/runtime, highlight an
item in a listbox??? (could be more than one thats why I allowed multiselect)
Cheers
Printable View
If I have a multiselectable listbox...
How do you programmatically/runtime, highlight an
item in a listbox??? (could be more than one thats why I allowed multiselect)
Cheers
Code:List1.Selected(2) = True
List1.Selected(5) = True
List1.Selected(8) = True
Doesnt that force a List_Click call????
I dont want that....
Why don't you want that? got code in the List1_Click event?
Then just use a boolean to tell the Event it's passed by code!
Code:Private ByCode As Boolean
Private Sub HighLight()
'Tell it it's called by code
ByCode = True
'Highlight the items
List1.Selected(2) = True
List1.Selected(5) = True
List1.Selected(8) = True
'End telling it's by code
ByCode = False
End Sub
Private Sub List1_Click()
'If it's called by code don't do anything!
If Bycode = True Then Exit Sub
'... rest of your code here
End Sub
Yeah Ive got that but I was wondering if there was a better/neater way of doing it...
Thanks anyway!
Yeah there's probably is a complicated API way, but this works.
Maybe http://www.mvps.org/vbnet/ has some API ways, but I don't know if it's worth the surfing :)