473,480 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 8354
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
3815
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
1
1880
by: Jason | last post by:
I have created a c-sharp app that has keyup, keydown events tied to the form. The form also has some other controls, buttons, labels and 1 custom control that I made which inherits from user...
12
4867
by: CLEAR-RCIC | last post by:
Hi, I'm having problems setting focus to a textbox on a web user contol on an asp.net web page. The following script works on normal asp.net pages: <script language="javascript"> function...
1
2259
by: Israel | last post by:
The problem: I want to know, definitively when a slider loses focus after a user has started sliding and hasn't released the mouse yet. It appears that this is captured with the WM_ACTIVATEAPP...
4
4277
by: Jon Slaughter | last post by:
I've created some custom controls and forms that allow the feature to temporarily transfer focus to a control that has been entered by the mouse. Everything seems to work fine but the problem I...
3
7486
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
3
4228
by: jan.loucka | last post by:
Hi, I looked around for this specific problem but could not find any answer - there's few things in VB but still nothing exactly like this so I'd appreciate any help. We're writing C# WinForm...
3
8529
by: jimatqsi | last post by:
I'm having trouble changing the focus from form to form. I've got a big form with two smaller forms. The main form takes the left 1/3 of the screen, subform1 the upper right, and subform2 the...
3
2422
by: zacks | last post by:
I am working on an application that has a UI that supports multiuple functions by means of a group of "plug ins". Each plugin is a class library. Each plugin contains a User Control that defines...
0
6915
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7054
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7097
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
6993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4493
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2993
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
567
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.