Click to See Complete Forum and Search --> : ListView & ImageList
Reese
October 8th, 2001, 01:34 PM
I am trying to perform Exercise 4.1 on Page 186 of Howard Hawhee's MCSD Training. The book doesn't tell you how to do some of the exercises or what the right way to do it is and I'm stuck.
I can't seem to populate ListView with what is in my ImageList Collection.
The syntax in the book isn't even the right syntax. It leaves stuff out. Can anyone help me with this. I assume I will have problems adding items based on key, index and icon values in a text box too if the syntax is wrong in the book.
Cakkie
October 8th, 2001, 04:00 PM
If I understand you correct, you need to show the content of an imagelist in a listview, the listview is called LV, and the imagelist is called LI.
private Sub Form_Load()
Dim img as ListImage
Dim sKey as Integer
for Each img In IL.ListImages
sKey = img.Index
LV.ListItems.Add Text:=sKey, Icon:=sKey, SmallIcon:=sKey
next img
End Sub
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Reese
October 9th, 2001, 08:13 AM
Thanks, I managed to figure it out just before you got back to me. You did it slightly differently though so it's good to know. I am having trouble with displaying path information in a column header of the list view though. Any idea how to do that?
Cakkie
October 9th, 2001, 08:28 AM
What exactly do you mean with 'path information'?
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Reese
October 9th, 2001, 09:02 AM
Nothing specifically. . . Date Modified, last accessed, file location, etc. I figure if I can get one, I can get the rest. I'm not sure if I would have to use the file system object to do that.
Also if I wanted to add items to a listview by way way of text box input, would they have to be added to an image list first?
Thanks for your help.
Cakkie
October 9th, 2001, 10:23 AM
In order to get that info, you will need to store the filename somewhere. There's no way to determine where the picture came from once it was added to a imagelist. When you add them, you could keep the filename in the tag of the listimage object. This way, you can get the information from the real file.
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.