469,903 Members | 1,552 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Set focus to main form from user component control

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
2 8085
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
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.

Similar topics

17 posts views Thread by Neil Ginsberg | last post: by
1 post views Thread by Jason | last post: by
12 posts views Thread by CLEAR-RCIC | last post: by
4 posts views Thread by Jon Slaughter | last post: by
3 posts views Thread by Simon Tamman | last post: by
3 posts views Thread by jan.loucka | last post: by
3 posts views Thread by zacks | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.