• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 66
  • Last Modified:

prevent lose focus

Is there a way to prevent/cancel a lost focus event in a .NET desktop app?
0
HLRosenberger
Asked:
HLRosenberger
4 Solutions
 
Éric MoreauSenior .Net ConsultantCommented:
the whole app or a specific control?
0
 
Shaun KlineLead Software EngineerCommented:
If you need to cancel the lost focus due to validation, you can use the validating event which has that capability.
0
 
anarki_jimbelCommented:
Just to add to Shaun Kline

See Control.Validating Event


If the Cancel property of the CancelEventArgs is set to true in the Validating event delegate, all events that would usually occur after the Validating event are suppressed.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
AndyAinscowFreelance programmer / ConsultantCommented:
Be very careful - it could end up the only way to use the PC is to pull the power cable out and power it up again.
1
 
anarki_jimbelCommented:
Just in case. I have found the following article that might be interesting:
http://geekswithblogs.net/dapostolov/archive/2009/06/14/the-validating-event-can-prevent-a-form-closing-properly.aspx
0
 
HLRosenbergerAuthor Commented:
thanks.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now