Results 1 to 2 of 2

Thread: Changing context menu dynamically

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2004
    Location
    LA
    Posts
    57

    Question Changing context menu dynamically

    Hello Guys,

    I’m trying to change context menu dynamically depending if the TreeView root is selected I want to use CMnuRoot menu else I want to use CMnuChild menu.
    But I’m getting an error: “Object instance is not set to an instance of the object” .
    Code:
    Private Sub TreeView1_MouseDown1(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TreeView1.MouseDown
           	
     If e.Button = MouseButtons.Right and TreeView1.SelectedNode.Parent Is Nothing Then
                    Me.CMnuRoot.Show(Me.TreeView1, New Point(e.X, e.Y))
                Else
                    Me.CMnuChild.Show(Me.TreeView1, New Point(e.X, e.Y))
            End If
        End Sub
    Please help.

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    That error is usually pretty easy to figure out, but what line of code generates that error? If you're stepping through your code, you can mouse over your objects and the tool tip will tell you that it set to nothing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width