Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

Validating Fires When Control Doesn't have focus on form close

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Malachy O'Connor - 02 Feb 2007 11:03 GMT
Hi,

I'm having weird problems with Valadating Events.

I have a number of countrols that handle their own Valadating events
in to perform data validation.
I also have a Custom control that contains Add, Edit, Delete, Save and
Cancel buttons.

The Causes validation property for this control is defaulted to true.
I pickup the mouse enter and leave events on the cancel button in
order to set the custom control CausesValidation property to true or
false depending on whether or not the mouse is over the cancel button.

Works a treat. However
If I press cancel and then close the form the validation method
of the control whoes validation event I had just avoided fires.
Even though the cancel button has focus.

This is the only time that the validation method fires when close
form  button is presses (unless the control being validated had
focus).

Any suggestions would be greatly apriciated,

I'm pulling my hair out here.

Cheers,

Malachy
Markus - 02 Feb 2007 12:31 GMT
> Any suggestions would be greatly apriciated,

Is it possible to override the OnClose or OnClosing method of the main
control and set the CausesValidation properties to false? Or is this too
late and the event is fired already before calling OnClosing?

hth
Markus
Malachy O'Connor - 02 Feb 2007 18:23 GMT
I guess I could do that.
I think i'll play around with it a bit more first though.
I don't think i should have to go to that extreme as (as far as I
know) a control that doesn't have focus should cause validate events
to be raised.

> > Any suggestions would be greatly apriciated,
>
[quoted text clipped - 4 lines]
> hth
> Markus

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.