title: c# loop listbox selected items
body: <p>I have a listbox on a form set to allow multiple selections. I want to loop through each selected item, store the selected value in a variable and do some work. I've tried many different variations of code to do this, but so far nothing has worked. Any help would be greatly appreciated! My code is below:</p>
  
  <pre><code>foreach (var item in systemList.Items)
  {
      string systemName = systemList.SelectedItems.ToString();
      //do some work//
  }
  </code></pre>