Solved

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

Posted on 2009-07-06
3
177 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.

738 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