Solved

I need an event handler to "eat" the Enter event for a Windows TextBox

Posted on 2009-07-06
3
176 Views
Last Modified: 2013-12-17
I have an event handler which gets called when the focus enters the control, using the Enter event. But in that event, depending on the value of some variable, I may need to set the focus somewhere else. The problem is that once my call to Focus() is called, the rest of the Enter event gets called and sets the focus to that control. But I want to the control on thecontrol where I call Focus().

Do you know how to eat the event so it will not get called?

I want to be able to call Enter for a TextBox control.

Thanks,
newbieweb
0
Comment
Question by:newbieweb
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
p_davis earned 500 total points
ID: 24789168
i might not be understanding what you want but if you don't want the rest of the event code to fire after you set focus, in it, then you can just return out of the method


return; //if void

return someBoolValue; // if bool

etc.
0
 

Author Closing Comment

by:newbieweb
ID: 31600354
AWESOME! That fixed something which I think was otherwise un-fixable!

Thanks.
newbieweb
0
 
LVL 22

Expert Comment

by:p_davis
ID: 24793490
cool, glad that helped.

thanks for the points.

perry
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 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