title: Treeview Control Set From Treeview Object Variable?
body: <p>I am trying to setup a Treeview Object, Set the nodes, and then update a control to have the values appropriately formatted. Right now I have the following code that works when I have it setting a control, but not a control from a variable. How do I set a local control from a variable?</p>
  
  <pre><code>Private Sub Form_Load()
  Dim iml As ImageList
  Dim TreeView0 As TreeView
  Set TreeView0 = New TreeView
  Set iml = New ImageList
  
  iml.ListImages.Add , "Open", LoadPicture("Folder\Open.bmp")
  iml.ListImages.Add , "Closed", LoadPicture("Folder\Close.bmp")
  iml.ListImages.Add , "Document", LoadPicture("Folder\Document.bmp")
  iml.ListImages.Add , "test", LoadPicture("Folder\Document.bmp")
  iml.ListImages.Add , "test2", LoadPicture("Folder\Document.bmp")
  iml.ListImages.Add , "test3", LoadPicture("Folder\Document.bmp")
  iml.ListImages.Add , "test4", LoadPicture("Folder\Document.bmp")
  iml.ListImages.Add , "test5", LoadPicture("Folder\Document.bmp")
  
  Set TreeView0.ImageList = iml
  
  TreeView0.Nodes.Add , , "Open"
  TreeView0.Nodes.Add , , "Closed"
  TreeView0.Nodes.Add "Open", tvwChild, "Document"
  TreeView0.Nodes.Add "Open", tvwChild, "test"
  TreeView0.Nodes.Add "Open", tvwChild, "test2"
  TreeView0.Nodes.Add "Closed", tvwChild, "test3"
  TreeView0.Nodes.Add "Closed", tvwChild, "test4"
  TreeView0.Nodes.Add "Closed", tvwChild, "test5"
  
  
  TreeView0.Nodes(1).Image = "Closed"
  TreeView0.Nodes(1).Text = "Closed [+]"
  
  TreeView0.Nodes(2).Image = "Closed"
  TreeView0.Nodes(2).Text = "Closed [+]"
  
  TreeView0.Nodes(3).Image = "Document"
  TreeView0.Nodes(3).Text = "Document"
  
  TreeView0.Nodes(4).Image = "test"
  TreeView0.Nodes(4).Text = "test"
  
  TreeView0.Nodes(5).Image = "test2"
  TreeView0.Nodes(5).Text = "test2"
  
  TreeView0.Nodes(6).Image = "test3"
  TreeView0.Nodes(6).Text = "test3"
  
  TreeView0.Nodes(7).Image = "test4"
  TreeView0.Nodes(7).Text = "test4"
  
  TreeView0.Nodes(8).Image = "test5"
  TreeView0.Nodes(8).Text = "test5"
  
  'THIS LINE FAILS (Property Invalid)
  TreeViewTest = TreeView0
  
  End Sub
  
  Private Sub TreeView0_DblClick() 'OK
  
  
  If TreeView0.Nodes(1).Expanded = True Then
      TreeView0.Nodes(1).Image = "Open"
      TreeView0.Nodes(1).Text = "Open [-]"
  ElseIf TreeView0.Nodes(1).Expanded = False Then
      TreeView0.Nodes(1).Image = "Closed"
      TreeView0.Nodes(1).Text = "Closed [+]"
  End If
  
  
  If TreeView0.Nodes(2).Expanded = True Then
      TreeView0.Nodes(2).Image = "Open"
      TreeView0.Nodes(2).Text = "Open [-]"
  ElseIf TreeView0.Nodes(2).Expanded = False Then
      TreeView0.Nodes(2).Image = "Closed"
      TreeView0.Nodes(2).Text = "Closed [+]"
  End If
  
  
  
  End Sub
  </code></pre>