Hi,

I cannot figure out why no ComboBox events are firing in my project.
I'm very new to .NET CF programming, so I might be missing something
obvious.

The event handler for "SelectedIndexChanged" gets fired when I first
set the DataSource of the ComboBox, but when I click on the ComboBox
in the emulator, no event handlers get called. Out of desparation,
I've added handlers to SelectedIndexChanged, KeyPress, KeyDown,
LostFocus, and MouseDown, but none of the handler fire.

Any suggestions would be greatly appreciated

RE: Stupid ComboBox event problem by srhartone

srhartone
Thu Jan 24 16:56:54 CST 2008

SelectedIndexChanged should work either programmatically or via the UI. Have
you tried using SelectedValueChanged instead, I tend to use this event where
required.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"paul.lundin1@gmail.com" wrote:

> Hi,
>
> I cannot figure out why no ComboBox events are firing in my project.
> I'm very new to .NET CF programming, so I might be missing something
> obvious.
>
> The event handler for "SelectedIndexChanged" gets fired when I first
> set the DataSource of the ComboBox, but when I click on the ComboBox
> in the emulator, no event handlers get called. Out of desparation,
> I've added handlers to SelectedIndexChanged, KeyPress, KeyDown,
> LostFocus, and MouseDown, but none of the handler fire.
>
> Any suggestions would be greatly appreciated
>

Re: Stupid ComboBox event problem by paul

paul
Fri Jan 25 08:55:00 CST 2008

Thanks for the reply.

I have tried both events. This is very frustrating because I must be
missing something obvious. On both the Windows Mobile 5 emulator and
a Windows Mobile 5 device the events fire when the ComboBox is
initialized, but not when it is changed through the UI.

Here's the code:

public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

this.comboBox1.DataSource = new String[]{"one", "two",
"three"};
}

private void valueChanged(object sender, EventArgs e)
{
MessageBox.Show("valueChanged");
}

private void indexChanged(object sender, EventArgs e)
{
MessageBox.Show("indexChanged");
}
}

Thanks again.


Re: Stupid ComboBox event problem by ctacke/>

ctacke/>
Fri Jan 25 09:50:41 CST 2008

I don't see the events being wired up. Are you sure they are in the
designer code? The event handler method names you have are not the ones
typically auto-generated by the designer. You can always add them
explicitly and see if it works.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


<paul.lundin1@gmail.com> wrote in message
news:fa8d2192-4a1d-466d-be03-23a1b825a9e5@f10g2000hsf.googlegroups.com...
> Thanks for the reply.
>
> I have tried both events. This is very frustrating because I must be
> missing something obvious. On both the Windows Mobile 5 emulator and
> a Windows Mobile 5 device the events fire when the ComboBox is
> initialized, but not when it is changed through the UI.
>
> Here's the code:
>
> public partial class Form1 : Form
> {
> public Form1()
> {
> InitializeComponent();
>
> this.comboBox1.DataSource = new String[]{"one", "two",
> "three"};
> }
>
> private void valueChanged(object sender, EventArgs e)
> {
> MessageBox.Show("valueChanged");
> }
>
> private void indexChanged(object sender, EventArgs e)
> {
> MessageBox.Show("indexChanged");
> }
> }
>
> Thanks again.
>



Re: Stupid ComboBox event problem by paul

paul
Fri Jan 25 14:10:48 CST 2008

Sorry, that was just an oversight in my post. The events are wired up
in InitializeComponent. I changed the names from those generated by
the designer because I've tried so many different things to get the
events to fire in the emulator.

//
// comboBox1
//
this.comboBox1.Location = new System.Drawing.Point(26,
26);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(115, 18);
this.comboBox1.TabIndex = 0;
this.comboBox1.DataSource = new System.String[] { "one",
"two", "three" };
this.comboBox1.SelectedIndexChanged += new
System.EventHandler(this.indexChanged);
this.comboBox1.SelectedValueChanged += new
System.EventHandler(this.valueChanged);

Tim

Re: Stupid ComboBox event problem by stealthrabbi

stealthrabbi
Tue Jan 29 11:20:23 CST 2008

On Jan 25, 9:55 am, paul.lund...@gmail.com wrote:
> Thanks for the reply.
>
> I have tried both events. This is very frustrating because I must be
> missing something obvious. On both the Windows Mobile 5 emulator and
> a Windows Mobile 5 device the events fire when the ComboBox is
> initialized, but not when it is changed through the UI.
>
> Here's the code:
>
> public partial class Form1 : Form
> {
> public Form1()
> {
> InitializeComponent();
>
> this.comboBox1.DataSource = new String[]{"one", "two",
> "three"};
> }
>
> private void valueChanged(object sender, EventArgs e)
> {
> MessageBox.Show("valueChanged");
> }
>
> private void indexChanged(object sender, EventArgs e)
> {
> MessageBox.Show("indexChanged");
> }
> }
>
> Thanks again.

Try changing your event handlers to not be 'private'. don't include an
visibility attribute. just void indesxChanged(...)