How to Make My Own Visual Basic Command Buttons


Having a program interface with no command buttons is like having a menu with no items to select. Having a program interface with extremely attractive command buttons must be like ordering off a menu with pictures and charts and all the fixings. Command buttons are buttons that run a script whenever the user presses it. Your computer is filled with them.

Things You'll Need

  • Image editor

Creating a Command Button Image

  • Load up your favorite image editor and create a box shape. Select the box icon and drag and extend the box tool until you create a rectangle.

  • Insert whatever text you feel completely describes the button's nature. Select the text tool icon and select an area with the mouse in which you wish to outlay text. Type the text you wish into the text box.

  • Create three instances of this button image. One of the instances must be when the button is not pressed down and is selectable. Another instance is called the down state, and this image shows when the button has been pressed or clicked on. The last instance is the disabled instance and only occurs when this button is visible but not selectable or click-able. To create these instances just create a different image file for each button graphic.

  • Edit the graphic slightly for each instance and save each graphic separately. "Button," "down button" and "disabled button" are three potential names for the image files. After you're finished creating imaging, you should have a total of three image files: one for the regular display, one for when the button is held down and one for when the button is disabled.

Adding the Command Button to Visual Basic

  • Load up Microsoft Visual Basic and then right-click the form in the navigation panel and go to Design View.

  • Click the button icon that is in the design tab under the control group.

  • Click the command button icon and drag the mouse over the form to create a box. After drawing the button on the form, click the the button and go to the Properties menu.

  • Click the picture attribute in Properties and select the first image instance of the button in its normal state.

  • Click the down-picture attribute in Properties and select the second image instance of the button in its down state.

  • Click the disabled picture attribute in Properties and select the third image instance of the button in its disabled state.

  • Click the play button icon at the top of the toolbar to run the form and check to see if the buttons work.

Tips & Warnings

  • By default, the picture type is embedded, which means the image is stored into Visual Basic. If you were to change the picture type to "linked," then the picture would be linked to the actual file. The linked picture type can cause errors if the original picture were to be moved, deleted and renamed.

Related Searches


  • Photo Credit search , find, help, web button, button, question image by creative from
Promoted By Zergnet


You May Also Like

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!