-
I asked this half an hour ago, but I then deleted it as I thought I had found the answer at :
http://www.vbsquare.com/tips/tip289.html
But it doesn't quite give me what I want.....
I have a listbox with a list of files in it.
I need to add the icon of the file into the front of the list box. The icon being based on the file type, e.g. .DOC, .XLS, .MSG, .TXT, .EXE etc.
The code referenced above adds the icon into a picture box - but I can't do a ListBox.AddItem to get it into the listbox.
Thanks for any help,
Chris
-
Use a ListView.
Looks nearly the same, but allows you to add icons.
- jamie
-
Brad Martinez is a bit of a god at this sort of thing, as plenderj said, best to use a listview, the next thing is to work out how to take the default icons of the files you want and add them to imagelist - one answer is to use the windows system imagelist, heres some example code (fairly complex)
http://www.mvps.org/btmtz/listview/systemimagelist.zip
hope this helps
-
Thanks Jamie....
That pointer and this information:
http://www.mvps.org/vbnet/index.html
seems to have solved it for me.
Cheers, Chris