请问C#winform窗体中用switch语句怎么实现切换comboBox选项时groupBox中的控件随之修改呢
RT。谢谢如:用if语句可以这样写,但是switch语句怎么实现呢privatevoidcomboBox_SelectedIndexChanged(objectsende...
RT。谢谢
如:用if语句可以这样写,但是switch语句怎么实现呢
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
this.groupBox.Visible = true;
string value = this.comboBox.SelectedItem.ToString();
if (value.Equals("小说"))
{
setValue1();
setValue2();
this.groupBox.Text = ”123“
this.label1.Visible = true;
this.textBox1.Visible = true;
}
} 展开
如:用if语句可以这样写,但是switch语句怎么实现呢
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
this.groupBox.Visible = true;
string value = this.comboBox.SelectedItem.ToString();
if (value.Equals("小说"))
{
setValue1();
setValue2();
this.groupBox.Text = ”123“
this.label1.Visible = true;
this.textBox1.Visible = true;
}
} 展开
2个回答
展开全部
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
this.groupBox.Visible = true;
string value = this.comboBox.SelectedItem.ToString();
switch(value)
{
case "小喊罩含郑笑说" :
{
setValue1();
setValue2();
this.groupBox.Text = ”闷迟123“
this.label1.Visible = true;
this.textBox1.Visible = true;
break;
}
}
}
{
this.groupBox.Visible = true;
string value = this.comboBox.SelectedItem.ToString();
switch(value)
{
case "小喊罩含郑笑说" :
{
setValue1();
setValue2();
this.groupBox.Text = ”闷迟123“
this.label1.Visible = true;
this.textBox1.Visible = true;
break;
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询