?
Solved

treeview image problem

Posted on 2003-02-21
3
Medium Priority
?
259 Views
Last Modified: 2006-11-17
No matter what  I do it seems that each node will have the same image applied to it from my imagelist.
Thes keys I use to access pictures from the imagelist work as I can use this on my form background with no trouble, however when I use these keys to the imagelist on my node I am stuck with the same image for every node.

 With TreeView1
        For Each obj1 In DencomGeo
            .Nodes.Add , , obj1.GeoReigonName, obj1.GeoReigonName
            .Nodes(obj1.GeoReigonName).Image = ImageList1.ListImages("geo").Picture
            For Each obj2 In obj1.RDCcollection
                .Nodes.Add obj1.GeoReigonName, tvwChild, obj2.rdcCode, obj2.RDCDescription
                .Nodes(obj2.rdcCode).SelectedImage = ImageList1.ListImages("rdc").Picture
                For Each obj3 In obj2.UICcollection
                    .Nodes.Add obj2.rdcCode, tvwChild, obj3.UIC, obj3.Description
                    For Each obj4 In obj3.clinicCollection
                        'We append the text 'DMISID' to our dmisid value so it can be
                        'accepted as a key. THis neccesitates that we remove that string
                        'from the key before we use the key as a sql parameter.
                        .Nodes.Add obj3.UIC, tvwChild, "DMISID" & obj4.clinicDMISD, obj4.clinicName
                    Next
                Next
            Next
        Next
    End With

0
Comment
Question by:mccainz2
[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 Comments
 

Expert Comment

by:dorin_bogdan
ID: 7992779
Try to replace the line:

.Nodes(obj2.rdcCode).SelectedImage = ImageList1.ListImages("rdc").Picture

with:

.Nodes(obj2.rdcCode).Image = ImageList1.ListImages("rdc").Picture
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 400 total points
ID: 7993415
Why dony you associate the imagelist with the treeview and specify the image as you add the node, e.g.,

.Nodes.Add , , obj1.GeoRegionName, obj1.GeoRegionName, "geo"
0
 
LVL 5

Author Comment

by:mccainz2
ID: 7994104
Azra, the short answer is that I sometimes become a tunnel-visioned ignoramus. That works like a charm. For some reason I never noticed the optional image parameter in that method.

THanks a bunch :)
0

Featured Post

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.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

741 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