HighTechTalks DotNet Forums  

RE: Control validation causes unexpected results

Dotnet Framework (WinForms Controls) microsoft.public.dotnet.framework.windowsforms.controls


Discuss RE: Control validation causes unexpected results in the Dotnet Framework (WinForms Controls) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Morten Wennevik [C# MVP]
 
Posts: n/a

Default RE: Control validation causes unexpected results - 12-11-2007 , 03:08 AM






Hi,

I'm not sure I understand your problem. The in the validating event you
determine that the value is not valid so the user is not allowed to leave the
control, but it does not prevent the value being set. If the user closes the
dialog by ALT-F4 or X he is free to do so. If you want to prevent the user
from closing the dialog if any of its content is invalid, override OnClosing()


--
Happy Coding!
Morten Wennevik [C# MVP]


"Angel Tsankov" wrote:

Quote:
Hello!

I encountered unexpected behaviour in a .NET 2.0 application. I put a
checkbox in a dialog and handled the Validating event
(checkbox_validation.OnValidating). All the handler does is

e.Cancel = true;

This results in the checkbox not changing its state the first time it is
clicked after the user has tried to close the dialog (e.g. by pressing
Alt+F4 or by clicking the Close button on the caption bar).

Can someone explain this behavior and/or suggest how to handle it?

Reagards,
Angel Tsankov


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.