Listview, change index programically

  • Thread starter Thread starter Jax
  • Start date Start date
J

Jax

Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but
it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax
 
Hi Jax,

There's also SelectedIndexes collection on the ListView. I am not sure it
can be modified but you might also want to check out this one.
 
Nope it's read only as well, I already tried. :(
Anyone else got any ideas?

jax
-----Original Message-----
Hi Jax,

There's also SelectedIndexes collection on the ListView. I am not sure it
can be modified but you might also want to check out this one.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but
it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax

.
 
Hi,

You have to set to true the ListViewItem.Selected property:

ListView.Items[ index ].Selected = true;

Cheers,
 
Thanks Todd and Ignacio!

Thats great and works fine!
Many more thanks
and some more
and another

:)
jax
 
Back
Top