Set focus to main form from user component control

  • Thread starter Thread starter Tom
  • Start date Start date
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
 
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.
 
Back
Top