Custom TextBox and SelectNextControl

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I have a custom textbox, where the tab key don't work yet. I would like to
implement this 'feature', so if the focus is on this custom textbox and the
user press the TAB key, the focus has to go to the next textbox.

Here's my code:

case (int)Keys.Tab:
this.Parent.SelectNextControl(this.Parent, true, true, true, true);
break;

But my code don't work. :-(

When the user press the TAB key, the first control on the form (TabIndex =
0) will be selected (focused) and not the control after the custom textbox
(the next control).

Can someone help me?

Thanks and Regards,
andersch
 
Hi Linda

I've found the failure. Sorry, that was my mistake. The following code works
now:

this.TopLevelControl.SelectNextControl(this, true, true, true, true);

And yes, my custom textbox is inherited from TextBox class.
Where did you write the code to select the next control?

I wrote this code in the method IsInputChar...

Thanks and Regards,
andersch
 
Back
Top