By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,306 Members | 1,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,306 IT Pros & Developers. It's quick & easy.

Set focus to main form from user component control

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

"Tom" wrote:
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

Nov 21 '05 #2

P: n/a
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.

"Tom" wrote:
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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.