A
Adam Honek
Hi,
I have the code below that I'm using in a tree view to detect what node the
user has clicked on.
It compiles but on runtime I get a type cast error.
I've used this method for both the tool bar and menu and it works fine
extending the "handles" property inherent within .net.
Isn't the type supposed to be "TreeNode"?
Private Sub tvSelectFolder_NodeMouseClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles
tvSelectFolder.NodeMouseClick
'Declare an object of type TreeNode
Dim pTreeViewNode As TreeNode
'Now let's find out which tree view node was clicked
pTreeViewNode = CType(sender, TreeNode)
'Each item corresponds to a different feature
Select Case pTreeViewNode.Name
'//Exit the program
Case "InboxNode"
End Select
End Sub
End Class
Thanks,
Adam
I have the code below that I'm using in a tree view to detect what node the
user has clicked on.
It compiles but on runtime I get a type cast error.
I've used this method for both the tool bar and menu and it works fine
extending the "handles" property inherent within .net.
Isn't the type supposed to be "TreeNode"?
Private Sub tvSelectFolder_NodeMouseClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles
tvSelectFolder.NodeMouseClick
'Declare an object of type TreeNode
Dim pTreeViewNode As TreeNode
'Now let's find out which tree view node was clicked
pTreeViewNode = CType(sender, TreeNode)
'Each item corresponds to a different feature
Select Case pTreeViewNode.Name
'//Exit the program
Case "InboxNode"
End Select
End Sub
End Class
Thanks,
Adam