title: transfer items from one listbox to another
body: <p>so far i have accomplished transfer a single select item from one lb1 to lb2 and vice versa. Now the problem is transfering the whole list of data from lb1 to lb2 and vice versa. if anyone could help please.
  using for loop will be much better.</p>
  
  <p>i am using the following code:</p>
  
  <pre><code>    private void add_Click(object sender, EventArgs e)
      {
          if (lb1.SelectedItem != null)
          {
              lb2.Items.Add(lb1.SelectedItem);
              lb1.Items.Remove(lb1.SelectedItem);
          }
          else
          {
              MessageBox.Show("No item selected");
          }
      }
  
      private void remove_Click(object sender, EventArgs e)
      {
          if (lb2.SelectedItem != null)
          {
              lb1.Items.Add(lb2.SelectedItem);
              lb2.Items.Remove(lb2.SelectedItem);
          }
          else
          {
              MessageBox.Show("No item selected");
          }
      }
  
      private void addall_Click(object sender, EventArgs e) //problem is here. adding all the items from lb1 to lb2
      {
          for (int i = 0; i &lt; lb1.SelectedItems.Count; i++)
          {
              lB2.Items.Add(lb1.SelectedItems[i].ToString());
          }
      }
  
      private void removeall_Click(object sender, EventArgs e) //problem is here. adding all the items from lb2 to lb1
      {
  
      }
  </code></pre>