一个简单的C#问题~~

来源:百度知道 编辑:UC知道 时间:2024/09/28 09:37:57
c#中这个语句怎么写
有一个combobox控件~~里面有两个数据
分别是国产车~和进口车~是保存在数据库里面的~~
就是这个语句:if(当combobox中的数据为进口车的时候)
if语句怎么写

if (comboBox1.SelectedItem.ToString().Equals("进口车"))
{
...
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.comboBox1.Text == "a")
{
this.label1.Text = "1";
}
else if (this.comboBox1.Text == "b")
{
this.label1.Text = "2";
}

}


string a = "";
if(combobox.selectvalue == value)
{
a = value
}

swith(a)
{
case a:
break;
base b:
break
}