title: double click item in listview c#
body: <p>i still cannot understand how to make the item in listview to be clickable and appear messagebox.</p>
  
  <p>this is my code.</p>
  
  <pre><code>private void button6_Click(object sender, EventArgs e)
      {
          ListViewItem listviewitem;
  
          listviewitem = new ListViewItem("John");
          listviewitem.SubItems.Add("Smith");
          listviewitem.SubItems.Add("kaya");
          listviewitem.SubItems.Add("bun");
          this.listView1.Items.Add(listviewitem);
          listView1.FullRowSelect = true;
  </code></pre>
  
  <p>//show header
              listView1.View = View.Details;</p>
  
  <pre><code>        // Loop through and size each column header to fit the column header text.
          foreach (ColumnHeader ch in this.listView1.Columns)
          {
              ch.Width = -2;
          }
  </code></pre>
  
  <p>}</p>
  
  <p>i have read itemActive and i have tried this. im adding <code>listView1.SelectedItems[0].Text</code></p>
  
  <pre><code>    private void button6_Click(object sender, EventArgs e)
          {
              ListViewItem listviewitem;
  
              listviewitem = new ListViewItem("John");
              listviewitem.SubItems.Add("Smith");
              listviewitem.SubItems.Add("kaya");
              listviewitem.SubItems.Add("bun");
              this.listView1.Items.Add(listviewitem);
              listView1.FullRowSelect = true;
  
              MessageBox.Show("You clicked " + listView1.SelectedItems[0].Text);
  }
  </code></pre>
  
  <p>this printout error </p>
  
  <blockquote>
    <p>argument out of range. '0' is not valid number of index.</p>
  </blockquote>
  
  <p>please help me with this.</p>