Set focus to main form from user component control

T

Tom

I am developing a VB.NET user control that is composed of a component
control (along with some classes, etc). This is probably a stupid question,
and should be easy, but I must be having a brain fart. In the control
itself, how do I set focus BACK to the form that the control is on? This
control does some maniuplation of an outside application (by starting up the
application and sending it keystrokes). What I want to be able to do is to
have the control, once it is done with the external application, to be able
to set focus back to itself (and the VB.NET form that contains the control).
The component control doesn't have a Focus nor a Parent property, so short
of passing in the parent via a property to the control, I am not sure how to
have it set focus back to itself.

Advice? Thanks in advance.

Tom
 
G

Guest

If you have a TextBox on your form for example:

Please try:

Me.TextBox1.Focus()

Or you could make the control have the TabIndex of 0 (zero) therefore when
the form gets the focus then the TextBoxes get the focus first.

I hope these are of help.
 

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