?
Solved

ListView

Posted on 2003-03-09
6
Medium Priority
?
343 Views
Last Modified: 2010-05-01
i am making a download manager, and am wondering how i can put an icon on the left side of a listview, kinda like they do in kazaa. I have multiple columns, so i'd imagine it'd have to be in the first column...but i dont know how to add an icon
0
Comment
Question by:boss302_lp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:sazhagianambi
ID: 8100607
Hi,

To Add Icons in Header Place one ImageList. Load it With Icons You Want. Place The Follwoing  Code to set Icon

   ListView1.ColumnHeaderIcons = ImageList1
   ListView1.View = lvwReport
   
   Dim objColumnHeader
   Set objColumnHeader = ListView1.ColumnHeaders.Add()
   objColumnHeader.Text = "Example"
   objColumnHeader.Width = 2000
   objColumnHeader.Alignment = lvwColumnLeft
   objColumnHeader.Icon = 1

Regards,
Nambi
0
 

Expert Comment

by:cocomobasic
ID: 8100914
hi

Assuming that you used Microsoft Windows Common Controls 6.0:

1. First, place a listview control and an imagelist control on the form.
2. Create the columns for the listview.
3. Add your desired icons to the imagelist.

type this code --------

Private Sub Form_Load()

    ' bind the listview and the imagelist    
    ListView1.SmallIcons = ImageList1
    ListView1.Icons = ImageList1
   
    ListView1.ListItems.Add , , "My Listview With Icon", 1, 1

End Sub


note: the 1, 1 on the add method is the index of the icon you placed on your listview.
     meaning, if you want the second icon that you placed, you should enter 2, 2
0
 

Accepted Solution

by:
cocomobasic earned 80 total points
ID: 8100927
hi

Assuming that you used Microsoft Windows Common Controls 6.0:

1. First, place a listview control and an imagelist control on the form.
2. Create the columns for the listview.
3. Add your desired icons to the imagelist.

type this code --------

Private Sub Form_Load()

    ' bind the listview and the imagelist    
    ListView1.SmallIcons = ImageList1
    ListView1.Icons = ImageList1
   
    ListView1.ListItems.Add , , "My Listview With Icon", 1, 1

End Sub


note: the 1, 1 on the add method is the index of the icon you placed on your listview.
     meaning, if you want the second icon that you placed, you should enter 2, 2

sorry for the note; its not the index of the listview, but the index of the icons you placed on your imagelist
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:boss302_lp
ID: 8107562
what if i already have items in the list, will this just automatically put it in front of all items, or do i have to make it do this each time an item is added?
0
 

Expert Comment

by:cocomobasic
ID: 8116156
hi again,

you must do this in every item you add. example:

Private Sub Form_Load()

   ' bind the listview and the imagelist    
   ListView1.SmallIcons = ImageList1
   ListView1.Icons = ImageList1
   
   ' 1st item
   ListView1.ListItems.Add , , "My Listview With Icon 1", 1, 1

   ' 2nd item
   ListView1.ListItems.Add , , "My Listview With Icon 2", 1, 1

   ' 3rd item
   ListView1.ListItems.Add , , "My Listview With Icon 3", 1, 1

End Sub

just change the 1, 1 to the index of the image in the imagelist to give them
different icons. that is if you want to.. hope this helps
0
 

Author Comment

by:boss302_lp
ID: 8116760
thanks a bunch
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question