Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Listview with images

Status
Not open for further replies.

mohansekar

Programmer
Jul 6, 2001
23
IN
Hi there,

could anyone tell me how to add images to listview control with piece of code plz. and also I should be able to activate some code by clicking on each image.

Expecting reply.

bye
 
Add a listview control to your form, link it with an image list(One for normal icons and other for small icons) then when you add an item to your list view do something like:

Lets say you are working with small icons and on your image list you hav an image with the key "small_image"

Dim xitem as listitem

lvwname.View = lvwReport 'This will use smallicons instead of icons, other views will use normal/big icons

Set xitem = lvwname.ListItems.Add(Key:="Your Key", Text:="Text_To_Show", Icon:="big_image", SmallIcon:="small_image")

Thats just about it.

To activate some code by clicking each item, just use treeview's item_click event.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top