Programmatically Clicking a Treenode
I have an explorer-like application, with a basic Treeview and Listview. When I click on a node in the treeview, it loads all items into the listview, including folders. I'd like to be able to programmatically click a node in the treeview, based upon if a folder was double-clicked in the listview.
Here's what I have so far:
'ListView DoubleClick Private Sub lstItems_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstItems.DoubleClick Dim SelectedItem As ListViewItem = New ListViewItem SelectedItem = lstItems.SelectedItems(0) If SelectedItem.SubItems(2).Text <> "File Folder" Then End If 'When user clicks on node, call Fill function, populating the treeview '... 'Change the global variable End Sub |
The problem is, when I try to declare a new node and either pass it through the nodeClick event, or call the Fill() subroutine directly, I get an error when I try to access the Node.FullPath property - "Full path can only be retrieved when a TreeNode has been added to a TreeView. This TreeNode has not been added to a TreeView."
How can I easily click the node needed when all I have is the text, ie: CurrentDirectory & "/" & SelectedItem.Text
Thanks for any suggestions.
-Jason

