Link to home
Start Free TrialLog in
Avatar of mccainz2
mccainz2

asked on

treeview image problem

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

Avatar of dorin_bogdan
dorin_bogdan

Try to replace the line:

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

with:

.Nodes(obj2.rdcCode).Image = ImageList1.ListImages("rdc").Picture
ASKER CERTIFIED SOLUTION
Avatar of AzraSound
AzraSound
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mccainz2

ASKER

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 :)