I am trying to figure out how to determine the parent node of the selected node "if any". Basically I have a context menu that I display when a node is clicked but I have different menus for different nodes selected. How can I determine this?
I have 3 Main parent nodes, index 0, 1, and 2, and I want to display this menu when a child node of parent node 0 is selected. anyone?
Code:Private Sub trvMain_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles trvMain.MouseDown 'Show the proper menu If e.Button = MouseButtons.Right AndAlso trvMain.SelectedNode.Index = 0 Then oMenu.MenuItems.Clear() oMenu.MenuItems.Add("New Zone", New EventHandler(AddressOf NewZone)) oMenu.MenuItems.Add("Load Zone", New EventHandler(AddressOf LoadZone)) oMenu.Show(trvMain, New Point(e.X, e.Y)) End If




Reply With Quote