I am working on a form where the user select a value from a combo box and
depending on his selection a popup window display, asking for more
information.

My problem is that this popup is displayed twice when the user makes the
selection. Another problem is that this combo box is on a multi tab page and
when the user selects the tab for the first time the combo is on, the popup
is also displayed twice.

How can I get the event to only fire once and only when the user selects an
item in the combo box?

Thanks in advance for your help,

Johannes

Re: Prevent a combo box SelectedIndexChanged event firing multiple by Sijin

Sijin
Tue Nov 09 03:07:52 CST 2004

Hey Johannes,

I think it would be a better idea for you to explicilty check if you are
already showing a popup before showing the popup. That would be easier
than making the selectionchanged event firing once.

Below is some sample code you could use

//On the selection change event

if(_alreadyShowingPopup)
return;
else
_alreadyShowingPopup = true;
ShowPopup();

Hope that helps.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

Johannes Vorster wrote:
> I am working on a form where the user select a value from a combo box and
> depending on his selection a popup window display, asking for more
> information.
>
> My problem is that this popup is displayed twice when the user makes the
> selection. Another problem is that this combo box is on a multi tab page and
> when the user selects the tab for the first time the combo is on, the popup
> is also displayed twice.
>
> How can I get the event to only fire once and only when the user selects an
> item in the combo box?
>
> Thanks in advance for your help,
>
> Johannes
>

Re: Prevent a combo box SelectedIndexChanged event firing multiple tim by Johannes

Johannes
Tue Nov 09 03:39:09 CST 2004

Hi

This will defenitely help.

On what event will I then clear the _alreadyShowingPopup variable, so its
ready for the next round of selection change events.

Johannes

"Sijin Joseph" <sijinNOSPAMdotnet@hotmail.com> wrote in message
news:uy%23zZujxEHA.260@TK2MSFTNGP11.phx.gbl...
> Hey Johannes,
>
> I think it would be a better idea for you to explicilty check if you are
> already showing a popup before showing the popup. That would be easier
> than making the selectionchanged event firing once.
>
> Below is some sample code you could use
>
> //On the selection change event
>
> if(_alreadyShowingPopup)
> return;
> else
> _alreadyShowingPopup = true;
> ShowPopup();
>
> Hope that helps.
>
> Sijin Joseph
> http://www.indiangeek.net
> http://weblogs.asp.net/sjoseph
>
> Johannes Vorster wrote:
>> I am working on a form where the user select a value from a combo box and
>> depending on his selection a popup window display, asking for more
>> information. My problem is that this popup is displayed twice when the
>> user makes the selection. Another problem is that this combo box is on a
>> multi tab page and when the user selects the tab for the first time the
>> combo is on, the popup is also displayed twice.
>>
>> How can I get the event to only fire once and only when the user selects
>> an item in the combo box?
>>
>> Thanks in advance for your help, Johannes
>>



Re: Prevent a combo box SelectedIndexChanged event firing multiple by jch

jch
Tue Nov 09 07:57:01 CST 2004

I guess you can use Form.Visible for the popup Window for this.

HTH, Jakob.


"Johannes Vorster" wrote:

> Hi
>
> This will defenitely help.
>
> On what event will I then clear the _alreadyShowingPopup variable, so its
> ready for the next round of selection change events.
>
> Johannes
>
> "Sijin Joseph" <sijinNOSPAMdotnet@hotmail.com> wrote in message
> news:uy%23zZujxEHA.260@TK2MSFTNGP11.phx.gbl...
> > Hey Johannes,
> >
> > I think it would be a better idea for you to explicilty check if you are
> > already showing a popup before showing the popup. That would be easier
> > than making the selectionchanged event firing once.
> >
> > Below is some sample code you could use
> >
> > //On the selection change event
> >
> > if(_alreadyShowingPopup)
> > return;
> > else
> > _alreadyShowingPopup = true;
> > ShowPopup();
> >
> > Hope that helps.
> >
> > Sijin Joseph
> > http://www.indiangeek.net
> > http://weblogs.asp.net/sjoseph
> >
> > Johannes Vorster wrote:
> >> I am working on a form where the user select a value from a combo box and
> >> depending on his selection a popup window display, asking for more
> >> information. My problem is that this popup is displayed twice when the
> >> user makes the selection. Another problem is that this combo box is on a
> >> multi tab page and when the user selects the tab for the first time the
> >> combo is on, the popup is also displayed twice.
> >>
> >> How can I get the event to only fire once and only when the user selects
> >> an item in the combo box?
> >>
> >> Thanks in advance for your help, Johannes
> >>
>
>
>

RE: Prevent a combo box SelectedIndexChanged event firing multiple tim by RonBarone

RonBarone
Tue Nov 09 13:13:03 CST 2004

Try checking for focus... This would indicate the user is on the combo via
the keyboard, or the combo was clicked with the mouse.

Of course you should probably set focus to something else when changing this
valud programatically.

You could also use the comboBox1.Tag to determine if it's code changing the
value... if it's code say Tag = "Code", then ignore the popup.

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if(comboBox1.Focused)
MessageBox.Show("Sel index changed");
}


Hope this helps....


"Johannes Vorster" wrote:

> I am working on a form where the user select a value from a combo box and
> depending on his selection a popup window display, asking for more
> information.
>
> My problem is that this popup is displayed twice when the user makes the
> selection. Another problem is that this combo box is on a multi tab page and
> when the user selects the tab for the first time the combo is on, the popup
> is also displayed twice.
>
> How can I get the event to only fire once and only when the user selects an
> item in the combo box?
>
> Thanks in advance for your help,
>
> Johannes
>