This is a really newbee question, I know, so bear with me...
I have a combobox on a form where the user can select a command to be sent to a GSM modem.
When the user has selected a command, he can press a "Send command" button that is also on the form. This buttons event handler will then process the command and do various stuff.
How do I retrieve the value of SelectedItem from the Combobox in the "Send Command" button's event handler? I know how to retrieve it inside the combobox' own event handler(s) (see example code)
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
// I can easily extract the selected item here and display it in a Text Box ("textBox1") as in the example below:
Object selectedCommand = smsCommands.SelectedItem;
textBox1.Text = selectedCommand.ToString();
// Loads the available commands into the combobox
private void LoadComboBox1()
smsCommands.Items.Add("Query PIN status");
smsCommands.Items.Add("Send PIN"); // AT+CPIN=1234
smsCommands.Items.Add("Select TXT Mode"); // AT+CMGF=1
// event handler for the "Send Command" button:
private void button1_Click(object sender, EventArgs e)
// How to I get the value of combobox' selectedItem here?
Thanks in advance.