listview error - code c#
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5298874/listview-error-c">listview error c#</a>  </p>
</blockquote>



<p>I have a ListWiev. I want to select the first element from it and than invoke a method. The thing is that though i have the element in the listview I dont know why the following code is not working when i want to select the element. need help. thx</p>

<pre><code>listview.Items[0].Selected = true;
listview.Select();
int c =listview.SelectedItems.Count;
MessageBox.Show(c + ": and : " + listview.Items[0].ToString()); .//here the c=0 and it should be 1:(
//  Thread.Sleep(3000);
method();  
</code></pre>

<p>I have: ` ListViewItem it = new ListViewItem("a");</p>

<pre><code>                it.SubItems.Add("s");
                it.SubItems.Add(""v");
                it.Tag = somethibg;
                listview.Items.Add(it);`
</code></pre>
