R
Rob Hindman
Hi, I have a simple windows form, with two ComboBox controls (and
several other controls). For both of the comboBox controls,
DropDownStyle=DropDown.
For some reason that I can't figure out, when the user pastes text
into the comboBox, the event fires twice. At first I didn't notice
this, but once I added error checking, I started seeing my error
twice. Here some example code:
private void comboBox_doit_TextChanged(object sender, System.EventArgs
e)
{
...
comboBox_doit.Items.Insert(1,comboBox_doit.Text);
...
}
Does anyone know how to prevent the second event from firing? I have
tried using BeginUpdate() & EndUpdate() around Items.Insert(), I have
tried using a simple bool semaphore, I have even tried unregistering
the event before calling Items.Insert(), and then adding a new event
handler after it...
I also can not figure out why this only happens to one of my
comboBoxes, and not the other one... Hmmm...
Alas, I am stuck... I would be grateful for any comments, suggestions,
or advice...
Many Thanks,
-Rob.
several other controls). For both of the comboBox controls,
DropDownStyle=DropDown.
For some reason that I can't figure out, when the user pastes text
into the comboBox, the event fires twice. At first I didn't notice
this, but once I added error checking, I started seeing my error
twice. Here some example code:
private void comboBox_doit_TextChanged(object sender, System.EventArgs
e)
{
...
comboBox_doit.Items.Insert(1,comboBox_doit.Text);
...
}
Does anyone know how to prevent the second event from firing? I have
tried using BeginUpdate() & EndUpdate() around Items.Insert(), I have
tried using a simple bool semaphore, I have even tried unregistering
the event before calling Items.Insert(), and then adding a new event
handler after it...
I also can not figure out why this only happens to one of my
comboBoxes, and not the other one... Hmmm...
Alas, I am stuck... I would be grateful for any comments, suggestions,
or advice...
Many Thanks,
-Rob.