Solved

Msgbox on validation appears many times

Posted on 2007-03-19
6
232 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 62

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now