Solved

Msgbox on validation appears many times

Posted on 2007-03-19
6
230 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
Comment Utility
Can we see your code?
0
 
LVL 62

Expert Comment

by:Fernando Soto
Comment Utility
It would help to see your code?
0
 

Author Comment

by:rishaan
Comment Utility
       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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:rishaan
Comment Utility
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
Comment Utility
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
Comment Utility
And do have a look at the Validate event too.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 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

12 Experts available now in Live!

Get 1:1 Help Now