473,395 Members | 1,639 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,395 software developers and data experts.

Cannot add bitmap to ListView other than in first column

GT
Could someone please explain how to add images to a ListView other than in
the first column?
Feb 9 '06 #1
2 4241
Hi GT,
not sure I am quite following you when you say "first column", since a
ListView is a one dimensional structure. What are you trying to do? If you
want a 2D structure you probably want to have a list of listviews which you
can access.

Mark Dawson
http://www.markdawson.org

"GT" wrote:
Could someone please explain how to add images to a ListView other than in
the first column?

Feb 9 '06 #2
GT
Ok, consider the example code given under the ListView class in the MSDN
library
(http://msdn.microsoft.com/library/de...lasstopic.asp).
The code generates a ListView with 4 colums and 3 rows (in additon to the
column heading) . At the end of the code example a bitmap image is added to
the cell elements in the first colums by using the .Images.Add() method (ref
cited code at the bottom of my reply).
My question is: How can the bitmap images be added to the ListView elements
other than in the first column, that is, where the example code displays the
integers 2,3,5,6,8 and 9?

==================================
' Create two ImageList objects.
Dim imageListSmall As New ImageList()
Dim imageListLarge As New ImageList()

' Initialize the ImageList objects with bitmaps.
imageListSmall.Images.Add(Bitmap.FromFile("C:\MySm allImage1.bmp"))
imageListSmall.Images.Add(Bitmap.FromFile("C:\MySm allImage2.bmp"))
imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLa rgeImage1.bmp"))
imageListLarge.Images.Add(Bitmap.FromFile("C:\MyLa rgeImage2.bmp"))

'Assign the ImageList objects to the ListView.
listView1.LargeImageList = imageListLarge
listView1.SmallImageList = imageListSmall

' Add the ListView to the control collection.
Me.Controls.Add(listView1)
End Sub 'CreateMyListView
======================================

"Mark R. Dawson" wrote:
Hi GT,
not sure I am quite following you when you say "first column", since a
ListView is a one dimensional structure. What are you trying to do? If you
want a 2D structure you probably want to have a list of listviews which you
can access.

Mark Dawson
http://www.markdawson.org

"GT" wrote:
Could someone please explain how to add images to a ListView other than in
the first column?

Feb 13 '06 #3

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

Similar topics

2
by: Ivan Figueredo | last post by:
Hi, I have successfully implemented a simple TreeView Control with a corresponding Listview. I know how to assign a bitmap to the first item of a Listview, but is it possible to add a bitmap...
6
by: VM | last post by:
How can I fill up a listview with text file contents? My listview has two columns and the first column fills up with a while loop: while (myString != null) { myString = sr.Readline();...
0
by: Andrew | last post by:
If item is a ListViewItem and str is a string, why do the following two lines not have the same effect ? item.SubItems.Add(new ListViewItem.ListViewSubItem()).Text = str;...
3
by: Rob Richardson | last post by:
Greetings! I am attempting to display data in tabular form using a ListView control in detail mode. This is for a program I originally wrote in VB6. In VB6, I would add an item to the...
7
by: BobAchgill | last post by:
I am trying to decide which of these controls to use to implement letting my user select a full row from MyList. The MyList has several columns which would be nice to sort by at run time. The...
12
by: J L | last post by:
When I fill a listview, I resize the columns to fit the data. I need to know if the data will fit vertically or if there will be a vertical scroll bar. I need to know this so I can allow for it on...
6
by: Dave | last post by:
VB6 has a SorkKey property that you can setup on the ListView control to tell the ListView what column to use for sorting. In .NET there is a Sort() method and a SortOrder property that you can...
10
by: Rob | last post by:
VS 2005 How can you tell if a value is contained in a specific column (let's say column 1 named Status) of a ListView ? In a list box you could go... If ListBox1.Items.Contains(strWhatever)...
0
by: Asja | last post by:
How can I do this? This question has been asked so many times on other forums without an answer, so I am not hopeful. OAKview has been suggested but it doesn't work, so please don't suggest that. I...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.