Tree Control Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a problem the first time I click on a node. In the below code, I
am catching the error "object reference not set to an instance of an object".

This is only on the deployed app. I don't get this when I run in the IDE.

Private SelectedNode As TreeNode

Private Sub treeBuiltRoutes_AfterSelect(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
treeBuiltRoutes.AfterSelect

If e.Node.Parent Is Nothing Then
Dim x As Integer
Try
x = SelectedNode.Index
Catch ex As Exception
MsgBox(ex.Message)
End Try
 
Where come from the SelectedNode object? I can't see where it's referenced.

Anyways, try to check if the e.Node object is nothing, before continue your
procedure.

[]s
Cesar



"EdB" <[email protected]> escreveu na mensagem
I am having a problem the first time I click on a node. In the below code,
I
am catching the error "object reference not set to an instance of an
object".

This is only on the deployed app. I don't get this when I run in the IDE.

Private SelectedNode As TreeNode

Private Sub treeBuiltRoutes_AfterSelect(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
treeBuiltRoutes.AfterSelect

If e.Node.Parent Is Nothing Then
Dim x As Integer
Try
x = SelectedNode.Index
Catch ex As Exception
MsgBox(ex.Message)
End Try
 
Back
Top