Cro0707
asked on
Focus on listbox (VB2005)
Simple form, on form there is one tab control. In first tab control, I have one list box called Lst_Job. What I want, when programs start that Lst_Job has focus.
But no, it doesn't go so easy. I put Lst_Main.Focus() in Form_Load but no luck.
WTF??! In VB6 is was so easy.
Also, If I have tabcontrol, how can I set shortcut button for each tab, like J&ob, &Private, etc?
But no, it doesn't go so easy. I put Lst_Main.Focus() in Form_Load but no luck.
WTF??! In VB6 is was so easy.
Also, If I have tabcontrol, how can I set shortcut button for each tab, like J&ob, &Private, etc?
Have you tried to set the taborder to 0 in the properties?
ASKER
Yes, it is 0.
Set on the tabcontrol Tabstop = false
You can also do Lst_Job.SelectedIndex = 0 to show the first file selected
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is just workaround for my problem.
This works (jpaulino) but I also need keyboard access to tabs... Wht this simple option doesn't work?!?
Form_Load
Lst_Job.focus ()
?!?
This works (jpaulino) but I also need keyboard access to tabs... Wht this simple option doesn't work?!?
Form_Load
Lst_Job.focus ()
?!?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK TeaHard, your solution works...
But I still need solution for second part of my question... Enyone? (250x4 is for TeaHard already)
But I still need solution for second part of my question... Enyone? (250x4 is for TeaHard already)
As I sad before, if you whant to do that you must capture the keypress event to do the job.
Hi,
put this after a button:
tabControl1.SelectedIndex = 1;
//The selectindex is the TabPage you want on top.
If you want to use KeyBoard triggers, see jpaulino also
Thanks.
put this after a button:
tabControl1.SelectedIndex = 1;
//The selectindex is the TabPage you want on top.
If you want to use KeyBoard triggers, see jpaulino also
Thanks.