Custom TextBox and SelectNextControl

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top