简体   繁体   中英

c# How do I open the combobox when the button is clicked

private void button1_Click(object sender, EventArgs e) { 
cb_brand_Click(cb_brand, new EventArgs());
}

detected as clicked, but not detected as a directory after adding and refreshing the data I typed

Hi you can try this,

private void button1_Click(object sender, EventArgs e)
    {
        comboBox1.Focus();
        comboBox1.DroppedDown = true;
    }

I'm not sure exactly what you are wanting to do but this should open ComboBox1 so you could put it in your on click event of the button. obviously change the name of ComboBox1 to whatever your combo box is called.

ComboBox1.DroppedDown = !ComboBox1.DroppedDown;

use this

private void button1_Click(object sender, EventArgs e) { 
    comboBox1.DroppedDown = true;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM