0

I am new to using Windows forms and am looking for help on creating a Tree Node Menu Structure in Windows Forms. I have tried reading the documentation on Microsoft docs and testing out the examples still with no clear understanding of how to create a tree node menu structure. Any help would be greatly appreciated as I am just learning Windows Forms.

Here is an example of how I would like the structure (the menu items should be tabs):

Node: Customers

-Child node: Add Customers

-Child Node: Add Customer Part

2
  • You do know that you can add a Menu to the form. It doesn't have to be docked. learn.microsoft.com/en-us/dotnet/api/… Commented Apr 8, 2022 at 18:49
  • Oh okay, Any idea how I would create a class that holds the main context and contains the sub context per main context? Commented Apr 8, 2022 at 19:25

1 Answer 1

1

Not 100% sure if this is what you are looking for, but basically define your context menu (assuming a right click here)

nodeMenu As ContextMenuStrip

Build your items and a menu handler, then when your node is selected, define which items of the menu will be available along these lines:

if node.Text.Equals("Customers") then
    nodeMenu.Items("Add Customers").Enabled = True
    nodeMenu.Items("Add Customer Part").Enabled = True
Else 
   'do something else
End If

but that is to add a menu to a node.

I think what you want is add nodes under a specfic node, if that is the case, I believe what you are after is more likely the answer here: https://stackoverflow.com/a/9963900/1946036

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.