473,548 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4256
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(Bitm ap.FromFile("C: \MySmallImage1. bmp"))
imageListSmall. Images.Add(Bitm ap.FromFile("C: \MySmallImage2. bmp"))
imageListLarge. Images.Add(Bitm ap.FromFile("C: \MyLargeImage1. bmp"))
imageListLarge. Images.Add(Bitm ap.FromFile("C: \MyLargeImage2. bmp"))

'Assign the ImageList objects to the ListView.
listView1.Large ImageList = imageListLarge
listView1.Small ImageList = imageListSmall

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

"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
6523
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 to any column of a Listview? Finally, I was wondering if it is possible to have the
6
4621
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(); listView1.Items.Add (myString); } Is there a way I can fill up the second column this easily? Thw way I'm currently doing it is using the subitems...
0
12268
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; item.SubItems.Add(str); In the example code that follows, using the first line (in the ListView constructor) causes the later redisplay of values (to some specified...
3
3273
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 ListView, and the item would automatically have the correct number of subitems, which I could access using array syntax. That doesn't seem to be the case...
7
14961
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 MyList data is resident in a dataset table. I'm stuck and can't choose either because. If I choose ListView as my control I don't understand how...
12
7465
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 the overall size of the listview. My question therefore is, how can I tell if the items I have added will fit in the listview at its given...
6
4790
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 use to manipulate the Sorting property. My question is how do I perform the same functionality as I do in VB6 setting the SortKey and SortOrder with...
10
4028
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) then How would you accomplish this using a ListView ?
0
1301
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 would like to know how to do it myself anyway, rather than use someone else's control. I would to add an image to the second column of a listview,...
0
7518
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7805
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6039
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5085
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1932
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.