响应一个combox选择事件就ok了嘛,写了个简单的测试程序:
String[] items1 = new string[] { "a", "b", "c" };
String[] items2 = new string[] { "aa", "bb", "cc" }; private void miSelectedChanged(object sender, EventArgs e)
{
String value = (string)comboBox1.SelectedItem; comboBox2.Items.Clear(); if(value == "a")
{
foreach(String ii in items2)
{
comboBox2.Items.Add(ii);
} }else if(value == "b")
{
comboBox2.Items.Add("bb");
}else if(value == "c")
{
comboBox2.Items.Add("cc");
}
} private void Init()
{
foreach (String str in items1)
{
comboBox1.Items.Add(str);
}
} private void miOnLoad(object sender, EventArgs e)
{
Init();
}
String[] items1 = new string[] { "a", "b", "c" };
String[] items2 = new string[] { "aa", "bb", "cc" }; private void miSelectedChanged(object sender, EventArgs e)
{
String value = (string)comboBox1.SelectedItem; comboBox2.Items.Clear(); if(value == "a")
{
foreach(String ii in items2)
{
comboBox2.Items.Add(ii);
} }else if(value == "b")
{
comboBox2.Items.Add("bb");
}else if(value == "c")
{
comboBox2.Items.Add("cc");
}
} private void Init()
{
foreach (String str in items1)
{
comboBox1.Items.Add(str);
}
} private void miOnLoad(object sender, EventArgs e)
{
Init();
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货