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 / July 2006

Tip: Looking for answers? Try searching our database.

Validating event firing twice when using UserControl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
maksim.yevstratov@gmail.com - 22 Jul 2006 03:49 GMT
Hi,

I have a UserControl with a TextBox in it. TextBox has Validating event

handler that can cancel the validation. If I place two UserControls
like this on a form then Validating event will be firing twice. To
demostrate this I put the following code inside the UserControl.

       private int count = 0;
       private void textBox1_Validating(object sender, CancelEventArgs

e)
       {
           e.Cancel = true;
           textBox1.Text = (count++).ToString();
       }

I can see then the couter growing by 2 every time I try to change focus

from one user control to another.

The behavior is the same in VS.NET2003 and VS2005.

Can anybody explain why it's happening and what could be a fix or
workaround?

Thanks
maks - 24 Jul 2006 14:10 GMT
I figured out that it happens only when using a mouse. When using
keyboard Validating event firing only once as it supposed to do. Looks
like a bug for me...

> Hi,
>
[quoted text clipped - 23 lines]
>
> Thanks

Rate this thread:







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.