Originally Posted by
arian
2- In a drop down menu the user can scroll the list by both mouse and arrow keys.
I want to send the selected item to another function at the select time but I dont know which event to use?!
By selected item I mean, the one which is clicked on while using mouse and the one which the user presses the enter key when he/she gets to it (while using arrow keys).
I believe "SelectionChangeCommitted" is the event you want.
Example:
Code:
comboBox1.SelectionChangeCommitted += new EventHandler(comboBox1_SelectionChangeCommitted);
void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{
MessageBox.Show(((ComboBox)sender).Text);
}
When you click on an item in the combo box, the "SelectionChangeCommitted" event is called, which in this case shows the item text in a messagebox.