473,396 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ListView images will not show!

OK, I am stumped. I cannot for the life of me get images to show in
ListView items while the view is set to Details. I create an
ImageList, set the SmallImageList to point to the ImageList, then in my
code I do the following to add items to the ListView.

lvi = New ListViewItem
With lvi
.Text = "xxxxx"
.SubItems.Add("yyyy")
.ImageIndex = 1
End With

This is a simplistic snippet of my code. I expect all the items I add
this way will show the image at index 1 from the ImageList. Nothing
shows. Seems there is a placeholder, but no image. I've tried every
combination I can think of. Ideas? TIA... Steve

Feb 14 '06 #1
1 4618
Hi steve,

First of all, please make sure of the following points :

1. Make sure your ListView.View property is set to Details view. (I think
you've done this.)

2. Make sure that you have the correct ImageList name as the
ListView.SmallImageList property.

3. Make sure to add Column headers using the Columns property. If this is
not possible at design time, create them at run-time,
but BEFORE you start adding list item values.

4. It worked for me, your code was slightly erroneous, so try this : (I am
assuming an ImageList with 3 images)
------------------------------------------------------
Dim i As Integer
For i = 0 To 3
Dim lvi = New ListViewItem()
With lvi
.Text = "Ein"
.SubItems.Add("stein")
.ImageIndex = i
End With
LV.Items.Add(lvi)
Next

------------------------------------------------------

Regards,

Cerebrus.
"Steve" <st*********@eglin.af.mil> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
OK, I am stumped. I cannot for the life of me get images to show in
ListView items while the view is set to Details. I create an
ImageList, set the SmallImageList to point to the ImageList, then in my
code I do the following to add items to the ListView.

lvi = New ListViewItem
With lvi
.Text = "xxxxx"
.SubItems.Add("yyyy")
.ImageIndex = 1
End With

This is a simplistic snippet of my code. I expect all the items I add
this way will show the image at index 1 from the ImageList. Nothing
shows. Seems there is a placeholder, but no image. I've tried every
combination I can think of. Ideas? TIA... Steve

Feb 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Anushya | last post by:
Hi I am using Listview and inherited listview control overriding WndProc & PreProcessMessage in ListView. I need this to customize listview to display only the page the user scrolls to. Since i...
0
by: Anushya | last post by:
Hi I am using Listview and inherited listview control overriding WndProc & PreProcessMessage in ListView. I need this to customize listview to display only the page the user scrolls to. Since i...
2
by: Anushya devi | last post by:
Hi All I used listview and tried to update it by using Addrange. When the number of items is less, it works fine.. But I need to update nearly 200,000 items and it hangs. Also i need to add...
2
by: Kanaiya | last post by:
hello how to put images in either listbox or listview.bye. -- With regards, Gangani Kanaiya.
5
by: luis | last post by:
Hi I would like to use a listview to show the tumbnails of images, the problem is the the images are shown too small, Is there any way to change the image size If it is not possible, is there...
3
by: Maarten | last post by:
hi all, is there a way to show the icons of a file, used by the system in a listview. now i have something like: Private Sub AddFiles(ByVal nod As TreeNode) Dim strPath As String =...
0
by: Michael Sgier | last post by:
Hi in my listView i have images like for ex. home.jpg. in the contextmenu it's possible to rename by simply entering for ex. cat. The extension gets added automatically but i cant get the listView...
8
by: Lord Zoltar | last post by:
Hi, I've got a list view that displays a series of images. I'd like to be able to draw a divider across the list view to divide the images into groups. Ideally, I'd have a group name, with a line...
0
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= | last post by:
I have a listview that when I select an item, it populates a details view. I want to show the item that was selected in the listview by changing it to yellow. Trouble is, the selected item does not...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.