lable显示组合框中的内容
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (this.listBox1.SelectedIndex)
{
case 0:
comboBox1.DropDownStyle=ComboBoxStyle.Simple;
break;
case 1:
comboBox1.DropDownStyle = ComboBoxStyle.DropDown;
break;
case 2:
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
break;
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label1.Text = this.comboBox1.SelectedItem.ToString();
}
调试的时候lable没有显示combobox中的内容
忽略1L,你这个是WinForms,没有什么AutoPostBack。
你检查下有没有将事件和事件处理函数关联起来。选中label1,在右边属性列表点闪电,然后找到Click,里面是不是绑定了label1_Click