Results 1 to 5 of 5

Thread: Initialize An Image List [TreeView Error] (Resolved)

  1. #1

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Initialize An Image List [TreeView Error] (Resolved)

    hey ya,

    I'm using a tree view to show a returned username & chat room to a person's search from my chat server,

    and add the items like:

    VB Code:
    1. ' Add the user name to the list
    2.             Dim n As Variant
    3.             Set n = tvRes.Nodes.Add(, , , SplitArr(0), imgLst.ListImages(1).Picture)
    4.             ' Add the users location to the list view
    5.             If InStr(SplitArr(1), "PRIVATE ") Then
    6.                 tvRes.Nodes.Add n, tvwChild, , "(Private)", imgLst.ListImages(2).Picture
    7.             Else
    8.                 tvRes.Nodes.Add n, tvwChild, , SplitArr(1)
    9.             End If

    TreeView = "tvRes"
    Username = "splitArr(0)"
    Room = "SplitArr(1)"

    only, i get the following error, and don't understand why?

    ---------------------------
    The Walks Chat
    ---------------------------
    Error 35613: ImageList must be initialized before it can be used
    ---------------------------
    OK
    ---------------------------
    how do i initialize the image list? [is this the image list for the imgLst or for TreeView.ImageList?
    Last edited by wpearsall; Feb 19th, 2003 at 05:14 PM.
    Wayne

  2. #2
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628
    You have to associate the tree view with the ImageList.
    So the treeview control I believe has an .ImageList property, you need to Set it to the ImageList Control.
    VB Code:
    1. Set Treeview.ImageList=ImageList
    Or try MSDN at this link
    http://msdn.microsoft.com/library/de...jImageList.asp

  3. #3

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    so, in my form load event, i added

    VB Code:
    1. set tvRes.ImageList = imgLst

    and then when it gets the line to add the item's to the t/v, it is now saying

    ---------------------------
    The Walks Chat
    ---------------------------
    Error 35603: Invalid key
    ---------------------------
    OK
    ---------------------------
    and is pointing to the image? :shrugs: i dunno why, but this seams to b pretty weird.

    does any one have an example i could use? or something ?
    Wayne

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    The Image parameter of the Nodes.Add method expects either the Index or the Key of the image, not the picture.


    tvRes.Nodes.Add n, tvwChild, , "(Private)", 1

    or

    tvRes.Nodes.Add n, tvwChild, , "(Private)", "PrivateIcon"

  5. #5

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065
    thank's! got it
    Wayne

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