Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programatically triggering tab key functionality in a VB.Net windows application

How can I programatically trigger the tab key functionality in a VB.Net windows application?

Currently in my application I am using one splitter when I press the tab key, and the focus is moving in the right order.

However I need to use arrow keys to move the focus to next controls, in the same way that the focus is going when the user presses the tab keys.

Thanks in Advance

like image 486
Ramesh Avatar asked Aug 29 '26 11:08

Ramesh


2 Answers

You can simulate the SendKeys.Send(string) method (in the Systems.Windows.Forms namespace). To simulate a tab keypress you would call SendKeys.Send("{TAB}").

To see all the key codes, check out http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx

like image 159
KallDrexx Avatar answered Aug 31 '26 16:08

KallDrexx


Better late, than never, since i found this post looking for a solution to a similar problem.

Windows Form type has ContainerControl somewhere in its chain of inheritance and that has a method ProcessTabKey(Boolean trueForForward) . It does exactly what you need, inside your form instance this.ProcessTabKey(true) will move focus forward along the tab index and this.ProcessTabKey(false) will move it backward.

like image 29
Koshelew Avatar answered Aug 31 '26 16:08

Koshelew