I have a ListView. I want to select the first element from it and then 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
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();
I have:
ListViewItem it = new ListViewItem("a");
it.SubItems.Add("s");
it.SubItems.Add(""v");
it.Tag = call;
listview.Items.Add(it);
for
and
this works and c is 1
The problem is probably somewhere else.