我是在构造函数里面定义的:
comboBox1.Items.Add("123");
comboBox1.Items.Add("456");
comboBox1.Leave += new EventHandler(this.comboBox1_Leave);
comboBox1.Items.Add("123");
comboBox1.Items.Add("456");
comboBox1.Leave += new EventHandler(this.comboBox1_Leave);
即
private void comboBox_SelectedIndexChanged(object sender, EventArgs e)
{
textBox.Text = comboBox.Text;
}
this.comboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox_SelectedIndexChanged);集成环境可以自动生成的啊,晕咯
{
comboBox1.Items.Add("123");
comboBox1.Items.Add("456");
comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged);
}void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
textBox1.Text = comboBox1.SelectedItem.ToString();
}
textBox4.Text=textBox4.Text+comboBox1.Text;
我把语句这样修改,本想得到如果textBox4 的text 属性为aaa 而我选择的comboBox1 的text属性为1234 那么选择后,希望结果为aaa1234 但是现在却是 aaa12341234 奇怪
就是正确的。