繁体   English   中英

Combobox selectedValue在C#中崩溃ControlBox

[英]Combobox selectedValue crashes ControlBox in C#

当我从我的组合框中分配所选值时,我的Winforms应用程序不会通过controlBox关闭(最小化,最大化工作但不关闭!)

如果我注释掉以下代码它似乎工作:

    private void Form1_Load(object sender, EventArgs e)
    {
        // TODO: This line of code loads data into the 'dataSet1.NewSelectCommand' table. You can move, or remove it, as needed.
        this.newSelectCommandTableAdapter.Fill(this.dataSet1.NewSelectCommand);

    }

    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string databaseName = string.Empty;
        databaseName = comboBox1.SelectedItem.ToString();
    }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    string databaseName = string.Empty;
    if(comboBox1.SelectedItem != null) databaseName = comboBox1.SelectedItem.ToString();
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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