By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,283 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,283 IT Pros & Developers. It's quick & easy.

Not calling Lost Focus event handler when I call Focus() method for a text box in C#

P: 1
I am working with .NET 3.5 framework within an WPF application. I have a windows application where for a textbox, I have defined the lost focus event. I need to call the Focus() method of any other control in a scenario where the first textbox's lost focus is being called automatically since we are moving out of the control. Is there any way to call Focus() method without calling the lost focus event handler for this textbox? I have tried removing the lostFocus event handler from the textbox before calling focus() method using "txtEID.LostFocus -= new RoutedEventHandler(txtEID_LostFocus);" but no use.

Thanks in advance for the help,
Ravi Kumar
Nov 13 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 7,872
Could you have a boolean value like "doLostFocusStuff"
and in your lost focus routine, check to make sure that the value is TRUE before performing any actions.
Then when you call your focus() on another control, you would just say like:

or something?
Nov 13 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.