I have a combo-box in a windows mobile application. I have added items to it in the following way:
cmb_task.Items.Add(new ListItem(taskid.ToString(), taskname));
I have done this b'coz i want to set a value field to the combobx to use later in my code.
In index change function i want to set selected value to a variable.
private void cmb_task_SelectedIndexChanged(object sender, EventArgs e) { taskid = Convert.ToInt32(cmb_task.SelectedValue); }
but somehow this piece of code is returning 0 as a selected value even if i select 2nd item from combobox with value=2.
Is there any other way to go about it?