PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Shortcut and CausesValidation
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Shortcut and CausesValidation
![]() |
Shortcut and CausesValidation |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I have a button with a shortcut (&Cancel) and property CausesValidation = false. When I click on the button the validating event is not fired but when I use the shorcut it's fired. Is there any solution to have the same behaviour with click and shorcut (event not fired) ? Thanks Alex |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Alex,
This is very strange behavior I must admit. It is even more that it works in the same way in .NET 2.0. The problem is that when the menonic key is pressed ProcessMnemonic calls PerformClick that kicks in the validation without checking the CausesValidation flag. I don't see other solution than to create your own button class and to override PerformMnemonic viartual method. Form inside the override don't call the base class, but rather fire the click event either calling directly OnClick method or calling InvokeOnClick (which will do basically the same. -- HTH Stoitcho Goutsev (100) "Alex" <Alex@discussions.microsoft.com> wrote in message news:B558D097-4D15-4013-8D2B-CE7A6653BAA2@microsoft.com... > Hi, > > I have a button with a shortcut (&Cancel) and property CausesValidation = > false. > When I click on the button the validating event is not fired but when I > use > the shorcut it's fired. > Is there any solution to have the same behaviour with click and shorcut > (event not fired) ? > > Thanks > > Alex |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

