日期:2014-05-18 浏览次数:21197 次
两个列表框联动,即两级联动菜单
     //判断第一个列表框中被选中的值
     switch(ListBox1.SelectValue)
     {
//如果是"A",第二个列表框中就添加这些:
case "A"
      ListBox2.Items.Clear();
      ListBox2.Items.Add("A1");
      ListBox2.Items.Add("A2");
      ListBox2.Items.Add("A3");
//如果是"B",第二个列表框中就添加这些:
case "B"
      ListBox2.Items.Clear();
      ListBox2.Items.Add("B1");
      ListBox2.Items.Add("B2");
      ListBox2.Items.Add("B3");
     }