Solved

Msgbox on validation appears many times

Posted on 2007-03-19
6
236 Views
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....
0
Comment
Question by:rishaan
6 Comments
 
LVL 6

Expert Comment

by:kerryw60
ID: 18751360
Can we see your code?
0
 
LVL 63

Expert Comment

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

Author Comment

by:rishaan
ID: 18752008
       private void SelectedRecord1_Changed(object sender, System.EventArgs e)
        {
            if (!processEvents)
            {
                return;
            }

          try
             {
                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);
            }
           
        }
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:rishaan
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...
0
 
LVL 3

Accepted Solution

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

Assisted Solution

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 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