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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setfocus in "Extended" listbox to Row X without Sendkeys 1

Status
Not open for further replies.

RobinRoslansky

IS-IT--Management
May 26, 2001
4
ID
If I use myListbox.Selected(5)= True I can "HighLite"/Select row 6 in the listbox. How do I move the focus to the same row without resorting to Sendkeys "{DOWN 6}" ? Robin Roslansky
Jakarta, Indonesia
 
The Multi Select property for this listbox is set to 'Extended'.

If you use myListbox.Setfocus followed by myListbox.Selected(5)=True the focus remains on row 0 (or row 1 if you use column headers) and row 6 is highlight/selected.

To make both appear on the same row I can use Sendkeys "{DOWN 6}", but I don't like using the Sendkeys command and nothing else I've tried seems to work.

If you click on a row both the focus and the highlight/select are placed on the same row. Robin Roslansky
Jakarta, Indonesia
 
Hi!

See at thread703-88530 Maybe codes what I posted here will you help.

Aivars
Riga, Latvia
 
What I discovered is that when you use a listbox with the Multi Select property set to 'Extended' the myListbox.SetFocus command is not needed.

I solved my problem by eliminating all myListbox.Setfocus commands and using myListbox.Selected(lngRowNo)= True followed by myListbox.Value = myListbox.Itemdata(lngRowNo)instead.

Thank you all for your comments. Robin Roslansky
Jakarta, Indonesia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top