By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

How to the item of listview selected automatically?

P: n/a
yxq
Hello
I want to first item of listview selected automatically, i write the code,
but it does not work.

ListView1.Focus()
ListView1.Item(0).Select = True

Thanks
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hello,

"yxq" <ga***@163.net> schrieb:
I want to first item of listview selected automatically, i write
the code, but it does not work.

ListView1.Focus()
ListView1.Item(0).Select = True

Set the ListViewItem's 'Selected' property to 'True'. Notice that you need
not set the focus to the ListView control, you may want to set the ListView
control's 'HideSelection' property to 'False'.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

P: n/a
"yxq" <ga***@163.net> wrote in message news:<es**************@TK2MSFTNGP09.phx.gbl>...
Hello
I want to first item of listview selected automatically, i write the code,
but it does not work.

ListView1.Focus()
ListView1.Item(0).Select = True

Thanks


I'm surprised that even compiles.
Do you meen:

ListView1.Focus()
ListView1.Items(0).Select = True

[Note the "s" at the end of "Items"]
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.