Hi everyone,
I have a UltraComboEditor which has a list of recipients. And when the form is loaded, for each Note (Form contains the Note Details), there will be a already a recipent loaded from the database. e.g. Amy is selected for loaded Note.
There will be a validation, if I select another recipient from the list, it will pop up a message saying "Do you wish to reforward this note to Andrew?", which "Andrew" is the newly selected recipient. If I say "Yes" , the combo value will be set to "Andrew", and save to database, or else it should be set back to the previous value which is "Amy".
My problem is when i put the following coding in the ValueChanged event, the message will pop up twice, since i set the selectedIndex back to the original. And also this event fires at the form loading where I load up the combo with the recipient.
Loading Data
==========
{
// I removed the events at the begining otherwise the message pops up when loading the Combo
DisplayData();
_recipientIdex = uceMessageSentTo.SelectedIndex;
}
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
else
uceMessageSentTo.SelectedIndex = _recipientIdex;
Can someone please suggest a solution to resolve this probelm. Urgent Help needed !
Thanks in Advance,
NW
Thanks for the reply Matt.
I found a solution using AfterCloseUp and BeforeDropDown Events.
Regards,
Since you know all of the places that you're going to cause the ValueChanged to be fired again, you could just keep a flag to bail out of the ValueChanged event handler while you're setting the SelectedIndex so that you don't repeat the logic.
-Matt