title: Get text of selected items in a ListBox
body: <p>I'm trying to  show the selected items of listBox1 in a Message Box here's the code:</p>
  
  <pre><code>int index;
  string  item;
  foreach (int i in listBox1 .SelectedIndices )
  {
      index = listBox1.SelectedIndex;
      item = listBox1.Items[index].ToString ();
      groupids = item;
      MessageBox.Show(groupids);
  }
  </code></pre>
  
  <p>The problem is that when I select more than one item 
  the message box shows the frist one I've selected and repeats the message 
  EX: if I selected 3 items the message will appear 3 times with the first item</p>