CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2001
    Posts
    16

    problem with listview control

    I am trying to add icons to listview control.But its giving Type Mismatch error.pls give the exact solution.

    I am using this code
    Private Sub Form_Load()
    dim lst as listview
    set lst=listview1.listitems.add(,,""CD")
    end sub

    Thanking you
    Vikram N.


  2. #2
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: problem with listview control

    Your example should give comple errors because of mismatched quote marks.
    In order to add Icons to the Listview, you must supply at least one Imagelist with the Icons in it.
    The format of the Listview.Add is:


    DIm NX as ListItem
    set NX = Listview1.Add(Index,Key,Text,Icon,smallIcon)
    NX.SubItems(1) = "Column 2 data"




    '
    Index relates to where it is positioned within the list, BLank puts it at the end
    '
    Key must be unique and Alphabetic
    '
    Text can be anything
    '
    Icon is a numeric pointer to a Imagelist Icon
    '
    Ditto for smallIcon
    [/vbcode]

    '
    '
    Please rate it if it answers the question
    or is useful.
    '
    John G

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

Featured