我想做以下事情:
如何做到这一点?
单击后,label1 =组合框项目1 +组合框项目2 + ...项目n
private void button1_Click(object sender,EventArgs e)
{
label1.Text = item1 + item2,...;
if (comboBox1.SelectedItem.ToString() == "item1")
{
text = "item1";
}
else if (comboBox1.SelectedItem.ToString() == "item2")
{
text = "item2";
}
}
答案 0 :(得分:2)
你需要三件事:
轻型代码示例:
private int _btnClickCount = 0; // your class-scoped variable
// your button click handler
private void SomeButtonClicked(object sender, EventArgs args) {
if (_btnClickCount == 0)
// do something
else if (_btnClickCount == 1)
// do something else
// etc.
_btnClickCount++;
}