[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to find out when active control changes?

Posted on 2008-01-28
7
Medium Priority
?
324 Views
Last Modified: 2013-11-26
Is there an event in visual studio .net that tell you that the active control has changed?

I have seen many questions about this but no answers.
0
Comment
Question by:3895
  • 4
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20761216
If you are talking about a WinForms Form, then it doesn't have an event that can detect when ActiveControl changes.  You could create a base class form that all of your forms derive from that can extend the default form to detect that case.

Bob
0
 

Author Comment

by:3895
ID: 20762010
Yes I am talking about windows forms.

I have no clue how to implement my own activecontrol-change event. Could you please help me with some code example.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20762090
I would, but you didn't indicate your preferred .NET language (C# or VB.NET).

Bob
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 

Author Comment

by:3895
ID: 20763963
I prefer vb.NET, thanks.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 20768263
Unfortunately what I thought would work, wouldn't work, so I am going to abandon that idea, and say that it might be possible, but I would now the exact steps.

Bob
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 750 total points
ID: 20797038
I found this that might work, where you add LostFocus and GotFocus event handlers to all the controls in a loop, and then keep track of the current control:

http://www.dotnet4all.com/dotnet-code/2004/10/windowsform-event-on-active-control.html

Bob
0
 

Author Closing Comment

by:3895
ID: 31425636
I guess it will do. It definitely works but I had hopedfor a more pretty solution.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question