How to the item of listview selected automatically?

  • Thread starter Thread starter yxq
  • Start date Start date
Y

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
 
Hello,

yxq said:
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'.
 
yxq said:
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"]
 
Back
Top