GetNextControl again ..
-
I plan to create a custom textbox class that when user press the enter key it will focus to another control. But i would like to check out that, should i place the GetNextControl method in the textbox class or in the base form class :confused:? I found that code below not working .. X|
public class baseTextBox:System.Windows.Forms.TextBox { protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Control ctrl = this.GetNextControl(this,true); ctrl.Focus(); e.Handled = true; } } }
Please advice. Thanks. -
I plan to create a custom textbox class that when user press the enter key it will focus to another control. But i would like to check out that, should i place the GetNextControl method in the textbox class or in the base form class :confused:? I found that code below not working .. X|
public class baseTextBox:System.Windows.Forms.TextBox { protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Control ctrl = this.GetNextControl(this,true); ctrl.Focus(); e.Handled = true; } } }
Please advice. Thanks.kakarato wrote: Control ctrl = this.GetNextControl(this,true); Dont use this. You are obviously refereing to the container (parent) Control or the Form hosting the control. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
-
kakarato wrote: Control ctrl = this.GetNextControl(this,true); Dont use this. You are obviously refereing to the container (parent) Control or the Form hosting the control. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots