Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with Selected() property on listbox… 1

Status
Not open for further replies.

utc13

Programmer
Oct 25, 2001
43
US
On a form I have two listboxes (lstCategory1, lstCategory2) where after I click an entry in the lstCategory1 listbox it sets the row source for lstCategory2. That part works fine. However what I’m having trouble with is after the row source for lstCategory2 is set I want the first item in the resulting list for lstCategory2 to be selected automatically.

I have the following code in the lstCategory1_Click event:

Code:
Me.lstCategory2.Selected(0) = True

This visually selects the first list item in lstCategory2 but when I check the ItemsSelected collection for lstCategory2 it is empty, even though the first item visually appears to be selected.  Am I missing something here?
 
Is lstCategory2 a MultiSelect listbox ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Nevermind. Idiot mistake. The listbox had been changed to single select and I didn't catch it. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top