开发者

Making a "click-out" event in C#

开发者 https://www.devze.com 2022-12-21 14:00 出处:网络
Is there any simple way to make a method that gets called whenever the user clicks out (or changes fo开发者_开发百科cus in some other way) from a text box in C#? I\'m not really familiar with the way

Is there any simple way to make a method that gets called whenever the user clicks out (or changes fo开发者_开发百科cus in some other way) from a text box in C#? I'm not really familiar with the way events are handled in C# - I rely on double-clicking a control to automatically generate the btn_Button_Click method.

Thanks!


Try Control.OnLostFocus, which occurs whenever the control loses focus.


You can get a list of events in the properties window for the control. If its not already visible, display the properties window from the view menu. Then select the control you want to add an event to, click the lightning bolt in the properties window (shows events) and add the event you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号