Hi everyone,

I have been working with VB6 for about a week now, so I'm still a newbie. I have a pretty big project coming up and I have a question relating to the capabilities of VB6.

I want a GUI that has a "Model" tree on the left, and a bunch of options, text-boxes, drop-down menus etc. in the main form, which are dependent on the branch that is selected in the model tree. In this tree, there are branches that allow me to edit my model, define analysis parameters, perform an analysis, view graphs etc. So I want to be able to click on any branch, with the form loading/showing the appropriate options for the user to play with.

As I said, this is new to me, and so I'm not in need of any code. Just the assurance that it's possible, and maybe a brief outline on how to do this. Hope this is clear for everyone. Thanks

Dani AI

Generated

For : this is easily achievable in VB6. As noted, both a single-form approach and an MDI approach work — the deciding factors are number of distinct “views” and how much state each view must keep. The guidance below gives practical, long-lived patterns and concrete implementation hints.

A simple, robust pattern for a handful of views is to place each view’s controls inside a Frame (or PictureBox) on the right side and toggle visibility when the TreeView node changes. This keeps everything on one form and is simple to debug:

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
    ShowView Node.Key
End Sub

Sub ShowView(viewKey As String)
    Dim ctl As Control
    For Each ctl In Me.Controls
        If TypeName(ctl) = "Frame" Then ctl.Visible = False
    Next
    Select Case viewKey
        Case "EditModel":        FrameEditModel.Visible = True
        Case "AnalysisParams":   FrameAnalysis.Visible = True
        Case "Graphs":           FrameGraphs.Visible = True
    End Select
End Sub

For many, complex views prefer modular UI components: design each view as a separate Form or VB UserControl, Load/Show only when needed and Unload when finished to conserve memory. Controls.Add can instantiate UserControls at runtime; alternatively Load/Unload forms work well and are simpler to reason about. MDI makes sense when multiple independent child windows are required, but adds focus/keyboard complexity.

Troubleshooting and best practices: use unique Node.Key values (not numeric indexes), keep business logic out of forms (store state in model objects), lazy-load heavy views, persist view state if users switch frequently, and ensure the Microsoft Common Controls (MSCOMCTL.OCX) used by TreeView is the correct version and registered on target machines. For maintainability, factor view selection into a single ViewManager routine and use descriptive keys or an enum to map nodes to loaders.

Yes you can definitely do this in VB 6.

You can potentially set this up as an MDI project with a container form holding a form with a Tree on the right, and then you will load other forms with the desired elements on the left depending on the selected tree node. OR you can have just a single form with a treeview on the left of the form and then you can dynamically make other form elements ( for user input ) visible or hidden on the right as needed depending on the tree node selected. For just a few nodes either approach can work, but if you will have many tree nodes ( and many different User Input styles ) then I'd probably go with the MDI approach as less confusing and easier to debug.

I hope this is helpful.

Jeff Bennett

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.