title: Displaying selected items of listbox into a message box
body: <p>I am able to display multiple selected items from a listbox into a text box on a button click but how can I display the same on a message box? I mean displaying first item on a messagebox is not an issue but multiple items at once is. Suggestions please...</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Windows.Forms;
  
  namespace cities
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              textBox1.Clear();
              foreach (object selectedItem in listBox1.SelectedItems)
              {
                 textBox1.AppendText(selectedItem.ToString() + Environment.NewLine);
              }
  
  
          }
  
          private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
          {
          }
  
          private void textBox1_TextChanged(object sender, EventArgs e)
          {
  
          }
      }
  }
  </code></pre>