Preselect item in listbox to allow keyboard ENTER to select

D

David

I'd like to preselect the first row in my listbox so a user can just hit the enter key rather than use the mouse to select it. I tried setting the .selected property but that just froze my listbox. is this possible?
 
M

MacDermott

Is your listbox's MultiSelect property set to something other than None?
If it's None, the .Selected property can't be used reliably.
You can set the listbox's ListIndex to 0, though, to select the first row -
or 1 if you're displaying headers.

HTH
- Turtle

David said:
I'd like to preselect the first row in my listbox so a user can just hit
the enter key rather than use the mouse to select it. I tried setting the
..selected property but that just froze my listbox. is this possible?
 
S

Stephen Lebans

Your statement is not entirely accurate. You can write to the ListIndex
prop as long as the control has the focus.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top