Solved

Msgbox on validation appears many times

Posted on 2007-03-19
6
238 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
[X]
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
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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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