Listboxes

m3ckon

Member
Joined
Oct 6, 2005
Messages
5
Programming Experience
Beginner
Hi there,

I have a listbox on a new web form and I want to be able to drag and drop folders onto the listbox.

Written the code and it creates a new listviewitem and displays it in the listbox.


However, the listitem displays as follows on the form:

ListViewItem: {"c:\folder"}

Can someone tell me why this is happening?

M3ckon

PS sorry for vaguness can include code if necessary
 
Do you mean that you are wanting it to show a folder icon? If that is what you mean, you will need an ImageList control with an icon of a folder in it. You would then pass the index of that icon along with the directory path when you are adding items to the listbox. For example:

listbox1.items.add(dirPath, 0) 'dirPath is a string containing the path of the folder we dragged in, and 0 is the index of the folder icon in our ImageList.

Make sure you associate the ImageList with the ListBox in the Designer by setting the LargeImageList and/or SmallImageList properties to the name of your imagelist. Let me know if you have any more questions.
 
Thanks,

I was creating a new listitem then adding it to the control instead of just using listbox1.items.add

works now :)
 
Back
Top