|
-
Mar 30th, 2009, 08:00 PM
#1
Thread Starter
Hyperactive Member
How to get the active control of the active form?
Hi all,
I want to get the active control (control which has the focus or where the cursor is on) each time the cursor moves to another control or each time a control receives a focus.
How do i do this?
Thanks.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 30th, 2009, 08:04 PM
#2
Re: How to get the active control of the active form?
you can use me.activecontrol. you need to handle the _gotfocus event of your controls
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 30th, 2009, 08:19 PM
#3
Thread Starter
Hyperactive Member
Re: How to get the active control of the active form?
 Originally Posted by .paul.
you can use me.activecontrol. you need to handle the _gotfocus event of your controls
thanks...
i forgot about the Me.ActiveControl... 
 Originally Posted by .paul.
you need to handle the _gotfocus event of your controls
isn't there a way to handle gotfocus by groups of items instead of doing it individually?
thanks.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 30th, 2009, 08:22 PM
#4
Re: How to get the active control of the active form?
 Originally Posted by adshocker
Hi all,
I want to get the active control (control which has the focus or where the cursor is on) each time the cursor moves to another control or each time a control receives a focus.
How do i do this?
Thanks.
Me.Active Control will work for getting the control that has the focus, but I don't think there is anything that easy for getting which control the Mouse is over.
Your best bet is to give all the controls the same MouseEnter event and in it use typeof sender to determine what type the control is and then trycast to convert it into to whatever control it is.
-
Mar 30th, 2009, 08:25 PM
#5
Re: How to get the active control of the active form?
 Originally Posted by .paul.
you need to handle the _gotfocus event of your controls
Enter and Leave, NOT GotFocus and LostFocus.
-
Mar 30th, 2009, 08:52 PM
#6
Thread Starter
Hyperactive Member
Re: How to get the active control of the active form?
thanks..
i'll give it a try.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|