Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

treeview image problem

Posted on 2003-02-21
3
Medium Priority
?
260 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
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

564 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