469,338 Members | 8,595 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,338 developers. It's quick & easy.

How to Set Selected Index for Listview

Is there a way to set a selected index for a Listview in a WinForms
application?

Thanks in advance,
Steve Murphy

Nov 16 '05 #1
4 49953
Steve Murphy wrote:
Is there a way to set a selected index for a Listview in a WinForms
application?

Thanks in advance,
Steve Murphy


ListView1.Items[<***YourIndex***>].Selected = true;

Good luck,
Andrey
Nov 16 '05 #2
Steve,

Are you asking about the items collection? If you are you can do something
like:

listView1.Items[1].Selected = true;

If this is not what you are asking about please repost with more specific
details.

Hope this helps.
Nov 16 '05 #3
ListView1.Items[<***YourIndex***>].Selected = true;


Thanks. That has helped. I don't know why I was overlooking that in the
docs.

Steve Murphy
Nov 16 '05 #4

"Brian Brown" <Br********@discussions.microsoft.com> wrote:
Are you asking about the items collection? If you are you can do something like:

listView1.Items[1].Selected = true;

If this is not what you are asking about please repost with more specific
details.

Thanks. That did the trick. As I said to Andrey, I don't know how I
overlooked it the docs.

Anyway, I've pretty much got what I want working.

Thanks again,
Steve Murphy
Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Sam Johnson | last post: by
7 posts views Thread by GTi | last post: by
3 posts views Thread by Steve | last post: by
3 posts views Thread by Tiago Salgado | last post: by
2 posts views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.