Large Treeview navigation menu
Posted on 2009-05-15
I'm developing an app which contains a large amount of data input screens, I've split these up into seperate forms which are then added as controls to a panel in the main form.
I've decided to use a TreeView control as a navigation menu to get to these different input forms. The only problem is the code needed to find out which treeview item was clicked and then display the form is quite bulky, for example:
If e.Action = TreeViewAction.ByMouse Then
If e.Node.FullPath = "Customers\Add Customer" Then
Dim AddCustCtrl As New AddCustomer
AddCustCtrl.TopLevel = False
AddCustCtrl.Dock = DockStyle.Fill
Whats the best way of cutting down this code - can you give me an example of a function that would allow this to be done more simply. If not then am I best putting all of this inside a dll so it is seperated and makes the code on the main form more managable? Or is there an entirely different way of doing this that is easier?
The treeview has over 60 different items.