Hi,
I am facing trouble with the following code.
Public Class Form1
Private PreviousTab As TabControl
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles Me.Load
With TreeView1.Nodes .Item("AdminMen u")
.Nodes.Item("Ad dCustomer").Tag = TabAddCust
.Nodes.Item("De leteCust").Tag = TabDeleteCust
End With
End Sub
Private Sub TreeView1_After Select(ByVal sender As System.Object, ByVal e As System.Windows. Forms.TreeViewE ventArgs) Handles TreeView1.After Select
If PreviousTab IsNot Nothing Then
PreviousTab.Vis ible = False
End If
If e.Node.Tag IsNot Nothing Then
Dim ActiveTab As TabControl = CType(e.Node.Ta g, TabControl)
ActiveTab.Visib le = True
ActiveTab.Dock = DockStyle.Fill
PreviousTab = ActiveTab
End If
End Sub
When I run it this 2 lines come out with the message of NullReferenceEx ception was unhandles object reference not set to an instance object.
.Nodes.Item("Ad dCustomer").Tag = TabAddCust
.Nodes.Item("De leteCust").Tag = TabDeleteCust
Please help.
I am facing trouble with the following code.
Public Class Form1
Private PreviousTab As TabControl
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles Me.Load
With TreeView1.Nodes .Item("AdminMen u")
.Nodes.Item("Ad dCustomer").Tag = TabAddCust
.Nodes.Item("De leteCust").Tag = TabDeleteCust
End With
End Sub
Private Sub TreeView1_After Select(ByVal sender As System.Object, ByVal e As System.Windows. Forms.TreeViewE ventArgs) Handles TreeView1.After Select
If PreviousTab IsNot Nothing Then
PreviousTab.Vis ible = False
End If
If e.Node.Tag IsNot Nothing Then
Dim ActiveTab As TabControl = CType(e.Node.Ta g, TabControl)
ActiveTab.Visib le = True
ActiveTab.Dock = DockStyle.Fill
PreviousTab = ActiveTab
End If
End Sub
When I run it this 2 lines come out with the message of NullReferenceEx ception was unhandles object reference not set to an instance object.
.Nodes.Item("Ad dCustomer").Tag = TabAddCust
.Nodes.Item("De leteCust").Tag = TabDeleteCust
Please help.