title: Fill String Array With ListBox Selected Items in C#
body: <p>I have a ListBox that has X amount (Varies from 9 - 90) of items. I'm trying to populate (On a button click) a string array with the items that are selected in the ListBox. Here is what I have so far</p>
  
  <pre><code>private void generateTam_Click(object sender, EventArgs e)
      {
          String sCombinedTam = "";
          String sTamResponseStart = "Dear $contacts.name.first,@\n@\nYour request has been received and completed.@\nThe following actions were taken:@\n";
          String sTamResponseEnd = "Thank you for choosing %company%, and have a great day!!@\n@\n$incidents.assigned.acct_id@\n%company%";
  
          sTamResponseStart = sTamResponseStart.Replace("@\n", System.Environment.NewLine); //Replaces token @\n with NewLine
          //Gets Actions Selected, Sends to Array
          String[] sActionItemsSelected = new String[actionsListBox.Items.Count];
          for (int x = 0; x &lt; actionsListBox.Items.Count; ++x)
          {
              if (actionsListBox.GetSelected(x) == true)
              {
                  actionsListBox.Items.CopyTo(sActionItemsSelected, 0);
  
              }
          }
          //Gets Profiles Selected, Sends to Array
          String[] sProfileItemsSelected = new String[profilesListBox.Items.Count];
          for (int x = 0; x &lt; profilesListBox.Items.Count; ++x)
          {
              if (profilesListBox.GetSelected(x) == true)
              {
                  profilesListBox.Items.CopyTo(sProfileItemsSelected, x);
              }
              else if (profilesListBox.GetSelected(x) == false)
              {
                  sProfileItemsSelected[x] = "";
              }
          }
          //Combines strings for end response
          for (int i = 0; i &lt; sActionItemsSelected.Length; ++i)
          {
              sCombinedTam = sCombinedTam + sActionItemsSelected[i] + "@\n";
          }
          sCombinedTam = sCombinedTam.Replace("@\n", System.Environment.NewLine);
          sTamResponseEnd = sTamResponseEnd.Replace("@\n", System.Environment.NewLine);
          sCombinedTam = sTamResponseStart + sCombinedTam + sTamResponseEnd;
          notesTextBox.Text = sCombinedTam;
  
          //Outputs ENTIRE index ListBoxes not just selected items.
  
      }
  </code></pre>
  
  <p>The problem comes at the end, instead of setting <code>notesTextBox.Text</code> to the combination string with only the ListBox Selected Items it sets it to the combination string with EVERY ListBox option.</p>
  
  <p>Any help would be greatly appreciated.</p>