In this example, the public properties of the MDBTree control are used to manipulate the view, features and visible item types.
Create a new Visual Basic project. Add the PI-MDBTree Control component to the project, and add a reference to the PISDK Type Library. Drop a PI-MDBTree control onto a new form. Size the control so that it can show few tree nodes. Drag a standard command button from the toolbox onto the form.
Paste the code into the Declarations section. Run the project. The form should come up with a single tree node for the default server (make sure that that default server is available). Expand the tree so that multiple nodes and node types are visible. Click the command button.
Private Sub Command1_Click()
Dim style As MDBTreeCtl.MDBStyles
style = MDBTree1.ViewStyle ' get initial style, should be DEFAULT style
MDBTree1.DisableHeadings = False
MDBTree1.DisableOSIConfig = False
MDBTree1.ShowDataValues = True
MDBTree1.ShowPathAsToolTip = True
MDBTree1.AutoExpandData = True
MsgBox "We now have 'maximum view', style has changed to CUSTOM"
MDBTree1.ViewStyle = MDBSTYLE_TAGS
MsgBox "Style is now set to TAGS"
MDBTree1.DisableContextMenus = True
MDBTree1.DisableAutoRefresh = True
MDBTree1.DisableAliases = True
MDBTree1.DisableProperties = True
MDBTree1.ShowPIUnitsOnly = False
MDBTree1.HideQueryDate = True
MDBTree1.ShowCheckBoxes = False
MsgBox "We now have 'minimum view', style has changed to CUSTOM"
MDBTree1.DisableContextMenus = False
MDBTree1.HideQueryDate = False