-
hello, I finally got the listview to look the way i though it was supposed to thanks to the help on here. but now im having one hell of a time trying to figure out how to input data to it.. i set up two columns. a listitem is a ROW in the listview right? because when i did listview.listitems.add, it inserted a new line. now.. how do I insert data into row1, column1, and row1, column2? etc etc.. and does this work like the listbox where you have a listindex to tell you what item it is on? please help or show some examples if you can, thanks!
Thai
-
Here's some help on the listbox
lisbox.additem will add an item to the list.
listbox.listindex will be the ordinal number of the currently selected item.
listbox.clear will remove everything from the list.
listbox.list(number) is used to either get the text at that location or to set the text at that location. ex..
mystring = listbox.list(1) .. to get ..
listbox.list(1) = mystring .. to set ..
listbox.removeitem(number) will remove that item.
Your best bet is to look at all the methods, etc that are part of a listbox... that's how you're going to learn the most about controls.. Get real friendly with the F1 key :)
-
uhm, not quite
was looking for examples on LISTVIEW, not listbox.. thanks though :)
--
anyway, I figured out how to add data, now.. im trying to figure out how to make it do something when one of the items is double clicked.. can someowne show me how to make it say the text of the column when the item if double clicked?
thanks for all the help,
Thai
-
You are correct. Listitems are like rows. The first column is the listitem itself. For columns after the first, you need to reference subitems.
Set itmX = frmForm.lstList.ListItems.Add(, key, column1Value)
itmX.SubItems(1) = "column2Value"
and so on.
-
cool..
thank you.. do you know how to find out what the current selected item is? like the listindex property of the listbox. i want a messagebox to display the listitem whenever it is double clicked. how would I do that? thanks again!
Thai
-
nevermind got it
amazingly, if you look hard enough.. theres a property called SELECTEDITEM.. im on crack today.. hehe thanks anyway everyone =)
Thai
-
There are two ways. You can loop through the collection of listitems and check the selected property:
for X = 1 to ubound(lstListView.ListItems)
if lstListView.ListItem(X).Selected = True then
' You know which was selected
end if
next
Or, you can use selecteditem:
X = lstListView.SelectedItem.Index