5 Replies - 27361 Views - Last Post: 25 November 2007 - 11:52 PM Rate Topic: -----

#1 kaymaf  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 03-October 07

select all items in listview

Posted 19 November 2007 - 09:37 PM

hi, can anyone help me solve this problem, i want to select all items from listview at once thru loop but it doesnt work. my code below

For i = 0 To ListView1.Items.Count - 1
ListView1.Items(i).Selected = True
Next i
Like in listbox, you will just setSelected=true. so if you have an idea just reply.
thanks
kaymaf

Is This A Good Question/Topic? 0
  • +

Replies To: select all items in listview

#2 f_soto  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 10
  • Joined: 20-November 07

Re: select all items in listview

Posted 20 November 2007 - 02:10 AM

View Postkaymaf, on 19 Nov, 2007 - 09:37 PM, said:

hi, can anyone help me solve this problem, i want to select all items from listview at once thru loop but it doesnt work. my code below

For i = 0 To ListView1.Items.Count - 1
ListView1.Items(i).Selected = True
Next i
Like in listbox, you will just setSelected=true. so if you have an idea just reply.
thanks
kaymaf

Try This...

For i As Integer = 0 To ListView1.Items.Count - 1 Step 1
ListView1.SetSelected(i, True)
Next i
Was This Post Helpful? 0
  • +
  • -

#3 kaymaf  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 03-October 07

Re: select all items in listview

Posted 20 November 2007 - 07:17 AM

View Postf_soto, on 20 Nov, 2007 - 02:10 AM, said:

View Postkaymaf, on 19 Nov, 2007 - 09:37 PM, said:

hi, can anyone help me solve this problem, i want to select all items from listview at once thru loop but it doesnt work. my code below

For i = 0 To ListView1.Items.Count - 1
ListView1.Items(i).Selected = True
Next i
Like in listbox, you will just setSelected=true. so if you have an idea just reply.
thanks
kaymaf

Try This...

For i As Integer = 0 To ListView1.Items.Count - 1 Step 1
ListView1.SetSelected(i, True)
Next i



hi f_soto , thanks for reply. this method is for listbox not list view
ListView1.SetSelected(i, True)
kaymaf
Was This Post Helpful? 0
  • +
  • -

#4 kaymaf  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 03-October 07

Re: select all items in listview

Posted 20 November 2007 - 07:26 AM

View Postkaymaf, on 20 Nov, 2007 - 07:17 AM, said:

View Postf_soto, on 20 Nov, 2007 - 02:10 AM, said:

View Postkaymaf, on 19 Nov, 2007 - 09:37 PM, said:

hi, can anyone help me solve this problem, i want to select all items from listview at once thru loop but it doesnt work. my code below

For i = 0 To ListView1.Items.Count - 1
ListView1.Items(i).Selected = True
Next i
Like in listbox, you will just setSelected=true. so if you have an idea just reply.
thanks
kaymaf

Try This...

For i As Integer = 0 To ListView1.Items.Count - 1 Step 1
ListView1.SetSelected(i, True)
Next i



hi f_soto , thanks for reply. this method is for listbox not list view
ListView1.SetSelected(i, True)
kaymaf




this function below works but it doesnt highlight the file icon or image and the highlight color is gray like SystemColors.control. so if you have any idea how to use sendkey pls help
For i = 0 To ListView1.Items.Count - 1
ListView1.Items(i).Selected = True
Next i
Was This Post Helpful? 0
  • +
  • -

#5 aceofspades686  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 6
  • View blog
  • Posts: 334
  • Joined: 08-October 07

Re: select all items in listview

Posted 21 November 2007 - 06:06 AM

Quote

this function below works but it doesnt highlight the file icon or image and the highlight color is gray like SystemColors.control


Check to make sure the listbox isn't ReadOnly and that you have Allow Multiple Selections set to true.

Quote

so if you have any idea how to use sendkey pls help

What do you need to use sendkey for?

Also, please always post your code between the code tags as such:
[ Code] Code goes here [ /Code] without the spaces of course.
Was This Post Helpful? 0
  • +
  • -

#6 Pwn  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 458
  • Joined: 25-November 07

Re: select all items in listview

Posted 25 November 2007 - 11:52 PM

 Dim myString As String = "howdy"
		ListBox1.Items.Add(myString)
		ListBox1.SelectedItems.Add(ListBox1.Items.Item(0))


Try this, it will highlight the item as it's added to the selecteditems collection

This post has been edited by Pwn: 25 November 2007 - 11:54 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1