ListView Array Problems.

Drath
02-28-2005, 01:22 AM
Hello I am trying to add arrays for looping while filling in a multi columned listview object, but I seem to have ran into a listview fault.

When doing something like this:

ListView1.ListItems(Item(i)).SubItems(1) = "BlaBla2"

It is saying that is an invalid key, meaning it isn't regonizing the Item(i) is an arrayed variable. This only is occuring on SubItems, my main add works fine, which is:

ListView1.ListItems.Add , Item(i), "BlaBla1"

webbone
02-28-2005, 01:40 AM
You need to use this syntax:


ListView1.ListItems(i).SubItems(1) = "BlaBla2"

Assuming that i is the index of the row you are wanting to address.



See MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbmthaddlistitems.asp

NEOLLE
02-28-2005, 01:41 AM
Could you show us the loop?

stevo
02-28-2005, 01:43 AM
2 things.

item is a reserved word for the listview and what type variable is item ?

Drath
02-28-2005, 02:22 AM
You need to use this syntax:


ListView1.ListItems(i).SubItems(1) = "BlaBla2"

Assuming that i is the index of the row you are wanting to address.



See MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbmthaddlistitems.asp

webbone comes to my rescue again, Thanks alot, kinda weird syntax though. Since when you are using strings you still need the brackets and the quotes.

Like

ListView1.ListItems("Item").SubItems(1) = "BlaBla2"

Anyways, thanks.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum