We help IT Professionals succeed at work.
Get Started

VB.NET TreeView Help

Last Modified: 2013-11-07
I am trying to build a simple application to enumerate Citrix Published Applications.  I understand how to loop through Application Folders and another loop for Published Applications.  The end state of what I am trying to achieve from this question is the below sample output.

Applicaitons (Folder)
       App1 (Application)
       App2 (Application)
       OpenOffice (Folder)
               App1 (Application)
               App2 (Application)
       MSOffice (Folder)
               App1 (Application)

Sample Code to enumerate Application Folders and Published Applications.  The published applications display with the full path to the folder, but I am not sure how to work it to populate a treeview so I figured the best approach was to do one loop of app folders, the another one of apps and place them in the treenode.  I will provide samples of both.

Question: Help me using VB.NET (2.0 framework) populate a TreeView with something simular to above
        Dim myFarm As New MetaFrameCOM.MetaFrameFarm
        Dim AppFolder As New MetaFrameCOM.MetaFrameFolder
        Dim RootAppFolder As MetaFrameCOM.MetaFrameFolder
        RootAppFolder = myFarm.GetRootFolder(MetaFrameCOM.MetaFrameObjectType.MetaFrameAppFolder)
        For Each AppFolder In RootAppFolder.SubFolders
            'Sample output Applications
            'Sample output OpenOffice
            'Sample output MSOffice
            ' I would need to do another .SubFolders on each folder and so on :( 
            ' Do I have to do this or can I use the below code to put an application in a folder in a tree view based on the output
' Yes, I understand variables are declaried twice.  This is due to only one "Attach Code Snippet" checkbox
        Dim myFarm As New MetaFrameCOM.MetaFrameFarm
        Dim MyApp As New MetaFrameCOM.MetaFrameApplication
        For Each myApp In myFarm.Applications
             'Sample output Applications\App1
             'Sample output Applications\App2
             'Sample output Applications\OpenOffice\App1

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE