title: Getting value from listview control
body: <p>Need help selecting the value from custID column in the ListView so that I can retrieve the value from the database and display it in the TextBoxes.The SelectedIndex not working in c#</p>
  
  <p>Thanks</p>
  
  <p><a href="http://img713.imageshack.us/img713/133/listview.jpg" rel="noreferrer">http://img713.imageshack.us/img713/133/listview.jpg</a></p>
  
  <p>My Code</p>
  
  <pre><code>private void yourListView_SelectedIndexChanged(object sender, EventArgs e)
  {
      if (yourListView.SelectedIndex == -1)
          return;
      //get selected row
      ListViewItem item = yourListView.Items[yourListView.SelectedIndex];
      //fill the text boxes
      textBoxID.Text = item.Text;
      textBoxName.Text = item.SubItems[0].Text;
      textBoxPhone.Text = item.SubItems[1].Text;
      textBoxLevel.Text = item.SubItems[2].Text;
  }
  </code></pre>