3 Replies - 30666 Views - Last Post: 08 April 2009 - 09:01 PM Rate Topic: -----

#1 nixdaemon000  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-September 08

How to select ListView Item

Posted 29 September 2008 - 11:34 AM

I have three columns in my ListView and they are ID,Name and Age, and from the properties of ListView i have set "FullRow" select to True and "MultiRow" select to false

ID Name Age
1 nix 12
2 pix 21
3 xin 22
4 xip 24

i want to select the ListView entire row where ID = 3

How do i do in vb.net 2008?

i will be glad if any one can help me. Before i did like this

me.myListView.Items(0).SelectedItems = 3
but this gave me an error

This post has been edited by nixdaemon000: 29 September 2008 - 12:19 PM


Is This A Good Question/Topic? 0
  • +

Replies To: How to select ListView Item

#2 magicmonkey  Icon User is offline

  • D.I.C Regular

Reputation: 106
  • View blog
  • Posts: 484
  • Joined: 12-September 08

Re: How to select ListView Item

Posted 29 September 2008 - 12:03 PM

Try

By Index...
myListView.Items(0).Selected = True



By Key...
myListView.Items("KeyValue").Selected = True



If you want to be safe, I would use a key instead of the index. When you add the item just use the ID as the key by converting it to a string.
Was This Post Helpful? 1

#3 nixdaemon000  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-September 08

Re: How to select ListView Item

Posted 29 September 2008 - 12:23 PM

i like to select the ListView's Row with ID column ='3' to be selected.
I already had a ListView which lists the items like above.
I tried with your way but it didn't worked. Is there any other options?
Was This Post Helpful? 0
  • +
  • -

#4 Ricendithas  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 59
  • Joined: 12-July 08

Re: How to select ListView Item

Posted 08 April 2009 - 09:01 PM

There is a ListView property called FullRowSelect. Set it to True.

Hope this helps. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1