Solved

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

Posted on 2009-07-06
3
174 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now