devxlogo

Placing A Combo Box Onto A Toolbar

Placing A Combo Box Onto A Toolbar

To put a combo box on a toolbar, create a place holder and positionthe combo box above the place holder in the z-order. You can’t place thecombo 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 combobox 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 ofthe combo box are the same as the PlaceHolder button.
     Private Sub Form_Load()	Dim btnX As Button	Me.Show	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 WithEnd Sub
    See also  Why ChatGPT Is So Important Today
  • devxblackblue

    About Our Editorial Process

    At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

    See our full editorial policy.

    About Our Journalist