I would like to be able to programmatically emulate the keyboard navigation for dialog boxes.
I have a custom hardware device with a keypad that I would like to use for dialog box navigation.
I know about Focus(), but I'd rather do something that automatically respected the tab order. By emulating the keyboard navigation I don't have to worry about re-inventing complex behavior for each type of control.
Does anyone know how to do this?
Thanks!
For Winforms, you want want the Control.GetNextControl()
method
For WPF, you want the UIElement.MoveFocus()
method
In Winforms:
Control nextControl = this.GetNextControl(myControl, true);
To simulate a tab press, I believe it's the following:
SendKeys.Send("{TAB}");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With