Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Placing A Combo Box Onto A Toolbar

To put a combo box on a toolbar, create a place holder and position the combo box above the place holder in the z-order. You can't place the combo box inside the place holder. Instead, follow these steps:
  • Create a button with the PlaceHolder style.
  • Show the form.
  • In the Form_Load event set the Top and Left properties of the combo box to the same value as the PlaceHolder button.
  • Set the z-order of the combo box to zero to bring it to the front.
  • In the Form_Resize event, make sure the Top and Left properties of the combo box are the same as the PlaceHolder button.
     Private Sub Form_Load()
    	Dim btnX As Button
    	Set btnX = Toolbar1.Buttons.Add()
    	btnX.Style = tbrSeparator
    	Set btnX = Toolbar1.Buttons.Add()
    	btnX.Style = tbrPlaceholder
    	btnX.Key = "combo"
    	btnX.Width = 2000
    	With Combo1
    		.ZOrder 0
    		.Width = Toolbar1.Buttons("combo").Width
    		.Top = Toolbar1.Buttons("combo").Top
    		.Left = Toolbar1.Buttons("combo").Left
    	End With
    End Sub
  • A. Nicklas
    Comment and Contribute






    (Maximum characters: 1200). You have 1200 characters left.



    Thanks for your registration, follow us on our social networks to keep up-to-date