Hi All,
I have created a 'CustomTextBox' class to nevigate focus by 'Enter' and 'Up' key in the .Net Winform development.
I am using given below code to do so.
public class CustomTextBox : System.Windows.Forms.TextBox
{
protected override void OnKeyDown(KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Return:
this.FindForm().GetNextControl(this, true);
break;
case Keys.Up:
this.FindForm().GetNextControl(this, false);
break;
}
}
}
Here, I am using 'FindForm()' method to get form container for the current TextBox, because I am thinking that 'FindForm()' method could have it's own heaviness to access it.
So my question is, Can I have different method or code to access current textbox's container form?
OR Do you have any idea to do the same by other ways ?
Thanks in advance.
(Could anybody having idea for this? Looking for solution.)