那位高手帮我写段C#代码

来源:百度知道 编辑:UC知道 时间:2024/05/16 16:23:11
选择组合框中的一项时显示列表框中的每一项 比如各年级的各班

private void InitList()
{
this.clstNames.Items.Add( "刘德华" );
this.clstNames.Items.Add("张柏芝");
this.clstNames.Items.Add("周润发");
this.clstNames.Items.Add("如花");

this.cboList.Items.Add("刘德华");
this.cboList.Items.Add("张柏芝");
this.cboList.Items.Add("周润发");
this.cboList.Items.Add("如花");

this.listBox1.Items.Add("刘德华");
this.listBox1.Items.Add("张柏芝");
this.listBox1.Items.Add("周润发");
this.listBox1.Items.Add("如花");

this.cboList.SelectedIndex = 0;
}
private void Form1_Load(object sender, EventArgs e)
{
InitList();
_oldcolor = this.button2.BackColor;