Results 1 to 10 of 10

Thread: list box with images

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    list box with images

    hi, I have list box and want to come with 32 X 32 images or logo on the list box how can I do that in visual basic!

  2. #2
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: list box with images

    Quote Originally Posted by Alidad
    hi, I have list box and want to come with 32 X 32 images or logo on the list box how can I do that in visual basic!
    what do you mean? can you explain in more detail?

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: list box with images

    what i mean that when i use list box that come with list, for samele that there is list of computer in list box, (disk, mouse, monitor and computer hardware) so i want to add icon or images next to the list of those name, in the list box, how can i do that!

  4. #4
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: list box with images

    Quote Originally Posted by Alidad
    what i mean that when i use list box that come with list, for samele that there is list of computer in list box, (disk, mouse, monitor and computer hardware) so i want to add icon or images next to the list of those name, in the list box, how can i do that!
    i dont believe the listbox supports images/icons. listview does though and other components

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: list box with images

    i see, do you know where i can learn more abou the listview with images/ icon!

    Alidad

  6. #6
    PowerPoster
    Join Date
    Apr 2005
    Location
    Debug.Print
    Posts
    3,885

    Re: list box with images

    Quote Originally Posted by Alidad
    i see, do you know where i can learn more abou the listview with images/ icon!

    Alidad
    if you search the forum for posts by me, youll find what youre looking for.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: list box with images

    You can add one to your toolbox from the "Project > Components > Controls tab > select MS Winwods Common Controls 6.0 > click OK. Then drag and drop a listview and imagelist controls to your form.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: list box with images

    I have tried with listview and imagelist controls, but how can i write code to make works! i tried with
    listview1.listitems.add ("general", (imagelist.index = "1"))

    is this is correct!

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: list box with images

    More list this.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     With ListView1
    5.         .AllowColumnReorder = False
    6.         .FullRowSelect = True
    7.         .HideSelection = False
    8.         .LabelEdit = lvwManual
    9.         .MultiSelect = False
    10.         .Sorted = False
    11.         .View = lvwReport
    12.         .ColumnHeaders.Add , , "Col1", .Width / 4
    13.         .ColumnHeaders.Add , , "Col2", .Width / 4
    14.         .ColumnHeaders.Add , , "Col3", .Width / 4
    15.         .ColumnHeaders.Add , , "Col4", .Width / 4
    16.         .Icons = ImageList1
    17.         .SmallIcons = ImageList1
    18.         .ListItems.Add , , "Item 1", , 1
    19.         .ListItems.Add , , "Item 2", , 2
    20.         .ListItems.Add , , "Item 3", , 3
    21.         .ListItems.Add , , "Item 4", , 4
    22.         .ListItems.Add , , "Item 5", , 5
    23.     End With
    24. End Sub
    Last edited by RobDog888; Mar 27th, 2006 at 12:23 AM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    38

    Re: list box with images

    thanks so much for your help, this code is helped me to undersand, but I forgot to ask, i also added frame1 and frame2 two, if i click one of catagories in listview called "general", it will bring frame1 on the floor and hide frame2, how can i write that code!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width