
  public partial class Demo : System.Web.UI.Page
  {
      protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
  
              Button1.Text = "-->";
              Button2.Text = "<--";
  
  
              ListBox1.Width = 200;
              ListBox2.Width = 200;
  
              //允许多选
              ListBox1.【SelectionMode】 = ListSelectionMode.Multiple;
              ListBox2.SelectionMode = ListSelectionMode.Multiple;
  
              ListBox1.Items.Add("语文");
              ListBox1.Items.Add("数学");
              ListBox1.【Items】.Add("物理");
              ListBox1.Items.【Add】("化学");
          }
      }
    
  
      protected void Button1_Click(object sender, EventArgs e)
      {
  
          move(【ListBox1】, ListBox2);
      }
      
  
      protected void Button2_Click(object sender, EventArgs e)
      {
          move(【ListBox2】, ListBox1);
      }
  
  
      void move(  ListBox srcList, ListBox destList)
      {
  
          for (int i = srcList.【Items】.Count - 1; i >= 0; i--)
          {
              ListItem item = srcList.Items[i];
              if (item.【Selected】)
              {
                  destList.Items.【Add】(item);
                  srcList.Items.【Remove】(item);
              }
          }
  
      }
  
  
  
  }
  
