Article ID: 190226
Article Last Modified on 7/1/2004
object.Add(ProgID, name, container)
Private Sub Command1_Click()
Dim MyCtrl As Object
' Add a new CommandButton to the first Band.
Set MyCtrl = Controls.Add("VB.CommandButton", "cmdTest", CoolBar1)
MyCtrl.Caption = "Test Button"
Set CoolBar1.Bands(1).Child = MyCtrl ' place on first Band
' Add a new TextBox to the second Band.
Set MyCtrl = Controls.Add("VB.TextBox", "txtTest", CoolBar1)
MyCtrl.Text = "Testing Text"
Set CoolBar1.Bands(2).Child = MyCtrl ' place on second Band
End Sub
Private Sub Command2_Click()
Dim MyCtrl As Object
' Add a new CheckBox to a new Band.
Set MyCtrl = Controls.Add("VB.CheckBox", "ckTest", CoolBar1)
MyCtrl.Caption = "Check Test"
CoolBar1.Bands.Add Child:=MyCtrl, Visible:=True ' add a Band
CoolBar1.Bands(CoolBar1.Bands.Count).Width = 1000 ' expand it
End Sub
187232 : How To Add Multiple Controls to a CoolBar Control Band
Keywords: kbhowto kbctrl kbcode KB190226