Karthikeyan
Karthikeyan

Reputation: 143

Change focus to ComboBox

I need to change focus to a ComboBox in my Windows Form on an event (say SelectedIndexChange event of another ComboBox). How do I achieve this?

Upvotes: 0

Views: 2994

Answers (2)

DividedSky
DividedSky

Reputation: 21

You can .Select() like this:

comboBox1.Select();

Upvotes: 2

Adam S
Adam S

Reputation: 3125

You should be able to use the .Focus() of the control you want to give focus to.

private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
    comboBox1.Focus();
}

Upvotes: 3

Related Questions