--- Keyboard Control Focus Move --- In the database of the database, you will have the form of input data. The maximum entry person's headache is after each filled a data, or then the other hand is pressed. Tab (but still cumbersome). The most characterized is: press Enter key (entering in the keyboard as long as one hand can be), you can also use the arrow keys to control.
The first step: Form's keypreview attribute is True Step 2: Follow the steps to set the TabINDEX in order: Write a method, the code is as follows: '--- Focusmove is function name--' --- ControlName is the the Control's Name Which you want to use --- Private Sub FocusMove () Sub FocusMove (ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ControlName1.KeyPress, ControlName2.KeyPress If e.KeyChar = ChrW (13 ) THEN '--- SelectnextControl IS A Function Will Be Introducesd Next --- SelectNextControl (Sender, true, true, true, false) End if End SubselectNextControl: From MSDN:
Activate the next control.
[Visual Basic] public function selectnextControl (_ byval cater as boolean, _ byval tabstoponly as boolean, _ byval Nested as boolean, _ byval wrap as boolean _) as boolean
[C #] Public Bool SelectNextControl (Control CTL, Bool Forward, Bool Tabstoponly, Bool Nested, Bool Wrap);
[C ] public: Bool SelectNextControl (Control * CTL, Bool Forward, Bool Tabstoponly, Bool Nested, Bool Wrap);
[JScript] Public Function SelectNextControl (CTL: Control, Forward: Boolean, Tabstoponly: Boolean, Nested: Boolean, Wrap: Boolean: Boolean;
Parameter CTL starts searching for Control. Forward If true, the TRUE is forwarded in the Tab key; if False is moved in the Tab key order. TabStoponly True indicates that the TabStop property is set to false; false is not ignored. NESTED TRUE indicates that includes a nesting sub-control (sub-control); false means not included. Wrap True means continuing to search from the first control from the Tab key after reaching the last control; false means not to search. Return Value If the control is activated, TRUE is true; otherwise, false.
Remarks If you set the control's ControlStys.selectable style to true, the control is included in another control, and all of its parent controls are visible and enabled, then the SelectNextControl method activates the next control in the Tab key order. The Windows Form Control in the list below is unsent. The control derived from the control from the list is also unsent.
Label Panel Splitter Linklabel (when there is no link in the control) Requirements platform: Windows 98, Windows NT 4.0, Windows Me, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 Series
The last thing to pay attention is to Tabindex settings. If the control is in GroupBox, then Groupbox is in the order of TabIndex, that is, if TextBox1 is in GroupBox1, groupbox1.index = 1, TextBox1.index = 2. And in SelectNextControl Parameter nested = true, you can. There are some details that everyone should pay more when they usually use. --- End ---