Fire event on textbox lose focus
26,640
Solution 1
There is a Control.Leave
in C#, which I think is perfect for your purpose.
you can go to events of the textbox in visual studio, and find the Leave
event.
The code generated will be like :
private void txtbox_Leave(object sender, EventArgs e)
{
//Check for available operation Code
}
Solution 2
Please explore the LostFocus
event in a textbox
. Hope it helps
Author by
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
I'm trying to call a method as soon as a TextBox on my screen gets 'un-focused' if that makes any sense? The user types in a username and as soon as that textbox loses focus I want to fire an event that checks if that username is indeed available.
Thanks!
-
Admin over 11 yearsAh perfect! Thank you very much, in Windows Phone it's called TextBox_LostFocus. But all the same. Thanks again
-
willy wonka over 6 yearsI can't see the LostFocus event into the list of events of the Properties panel in MS C# Express 2008. I can only see Leave event.