Msgbox on validation appears many times

Posted on 2007-03-19
Last Modified: 2010-08-05
I have 2 sets of radio buttons  where value choosen in 1 set is  dependent
on the other set.

In buttonselectionchanged  event I have the code to throw an exception if value choosen is wrong and then in catch handler I show that message. But its getting called 2-3 times...showing message box 2-3 times...

How can we avoid  this....
Question by:rishaan
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 18751360
Can we see your code?
LVL 63

Expert Comment

by:Fernando Soto
ID: 18751639
It would help to see your code?

Author Comment

ID: 18752008
       private void SelectedRecord1_Changed(object sender, System.EventArgs e)
            if (!processEvents)

                if ((rb1h.Checked) && (rb2.Checked))
                    throw new ApplicationException("Message 1");

                if ((rb1.Checked) && ((rb2.Checked) | (rb3.Checked)))
                    throw new ApplicationException("Message 2");


            catch (Exception ex)
                ShowError("ABC", ex.Message);
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.


Author Comment

ID: 18752034
This method is called on selection changed event of rb1,rb2,rb3 etc...
After showing the message again this procedure is called..

Similarly with combobox...

Accepted Solution

Kate12 earned 350 total points
ID: 18753731
Try hooking up the rb1, rb2 and rb3 "Click" event and not selection changed.

Assisted Solution

by:Peter Skov
Peter Skov earned 150 total points
ID: 18754505
And do have a look at the Validate event too.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor ( Top Charts is a view in which you can set seve…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

626 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