Solved

prevent lose focus

Posted on 2016-09-15
6
56 Views
Last Modified: 2016-09-20
Is there a way to prevent/cancel a lost focus event in a .NET desktop app?
0
Comment
Question by:HLRosenberger
6 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 41800475
the whole app or a specific control?
0
 
LVL 26

Assisted Solution

by:Shaun Kline
Shaun Kline earned 125 total points
ID: 41800524
If you need to cancel the lost focus due to validation, you can use the validating event which has that capability.
0
 
LVL 29

Assisted Solution

by:anarki_jimbel
anarki_jimbel earned 250 total points
ID: 41800635
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 44

Assisted Solution

by:AndyAinscow
AndyAinscow earned 125 total points
ID: 41801062
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
 
LVL 29

Accepted Solution

by:
anarki_jimbel earned 250 total points
ID: 41804258
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
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 41806750
thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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