473,320 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to detect which control in a form got forcus

There are several controls in my form. How to detect currently which control
has the forcus and set the forcus to a certain control?

Thanks,
Sep 20 '06 #1
1 1936
Gary,

Check the form's ActiveControl property. It will give you the focused
control. Set the propery to change the focus.

This propery is defined in the the IContianerControl interface. That means
if your form has a control that implements this interface and this control
contains the focused control the form's ActiveControl will return reference
to the container (not to the actually focused
control). Thus what you need to do is to check wheter the control in the
ActiveControl property implements IContainerControl and if so get its
ActiveControl propery and so on. Most used controls that implement this
interface are Form, UserControl and the SplitContainer. There are couple
more, but I suggest to check the docs for that.

When you want to change the focused control though, you can do it on any
level of the contianer control hierarchy. The propery setter will take care
of updating the actuall container.

Most used conteiner controls are Form and UserControl.

"Gary" <Ga**@discussions.microsoft.comwrote in message
news:C6**********************************@microsof t.com...
There are several controls in my form. How to detect currently which
control
has the forcus and set the forcus to a certain control?

Thanks,

Sep 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: selowan | last post by:
Hi, In VB6 Pro SP5, I have a form that contains an MSFlexGrid and a few other textboxes and comboboxes. I am using the technique from MSDN article Q241355, which describes how to tab and edit in...
2
by: Keith Wilby | last post by:
The link below: http://support.microsoft.com/default.aspx?scid=kb;en-us;128814 to the Microsoft KB "Detect Idle Time" article shows how to detect "idle" time. However, if a user is active but...
4
by: vulcaned | last post by:
Hi All, Hopefully I explain this well........ In Access97 I have a form which has a tab control on it, each tab has a sub-form which is bound to its appropriate table(I'll call them 'Detail'...
3
by: Kubik | last post by:
Hello! How to detect mouseclick anywhere on the form? There is a lot of controls on the form, so I don't want to add eventhandler for each of them. How can I do it in another way? Adam --...
1
by: Ludovic Lemarinel | last post by:
Hi, I've got a Tab Control, with a lot of tabs, and a lot of controls in each tab (textboxes, comboboxes, listviews, checkboces, etc...). As these controls are updating a Database, I need to...
7
by: kkk | last post by:
I need to control something (visibility of toolbar buttons) when the cursor moves between fields on a form (using VB .net). How do I detect that the focus has moved? Thanks, Paul.
1
by: timnels | last post by:
I have a control that paints a borderless form below it to act as a grid combo box. When the parent for is moved I need the control to detect that the parent form is moving/moved and move the...
8
by: BJ | last post by:
Problem: How can I code up a client side process to detect if the network is available? Synopsis: I am writing ASP.NET input forms for a Panasonic Tuff book. The users will be walking around...
1
by: Gary | last post by:
I have a Form.control, a textbox in a form. Initially, the control has forcus. However, after user click this control, I need to insert something into the textbox, which caused the losing forcus of...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.