Knowledge Base 
Adding CommandBars at run time 
 Wednesday, August 10, 2022

Adding CommandBars at run time

You can add commandbars at run time by using the CreateCommandBar method of the CommandBarsManager object.

This sample code illustrates how to add new commandbar at run time:

loBar = ThisForm.CBM.CreateCommandBar()
loBar.Caption = "Sample command bar"
loBar.DockPosition = 0
loBar.Visible = .T.
... add controls here
&& required if the CBM object was initialized earlier
If ThisForm.CBM.IsInitialized()
    ThisForm.CBM.InitCommandBar( m.loCmdBar)