Click to See Complete Forum and Search --> : Unload toolbar


Off
June 29th, 2001, 01:23 PM
Hi, i would like peace of code to be able to unload a toolbar in a form.

Thanks in advance

John G Duffy
June 29th, 2001, 02:46 PM
If the toolbar is created at DEsign time, you can't. The best you can do is set its .Visible property to False.
If the Toolbar was created at run time then you can use the remove method to do so.
Here is a sample. Start a new project. Add a toolbar and three command buttons.
Paste this code into the general declaration serction of the form. Run it

private Sub Command1_Click()
' Make IDE created toolbar invisible
Toolbar1.Visible = false
End Sub

private Sub Command2_Click()
' Create a toolbar at run time
Dim tbr as Toolbar
set tbr = Form1.Controls.Add("MSComctlLib.Toolbar", "tbr1")
tbr.Visible = true
tbr.Align = vbAlignBottom
tbr.BorderStyle = ccFixedSingle
tbr.Buttons.Add , "A", "A"
End Sub

private Sub Command3_Click()
' Remove run time created toolbar
Form1.Controls.Remove "tbr1"
End Sub




John G