Microsoft Visual Basic 6 Professional (step by step)
A command button with selection handles appears on the form. The button is named Command1, the first command button in the program. (You might make a mental note of this button name—you’ll see it again later when you write your program code.)
You can move command buttons by dragging them with the mouse and you can resize them by using the selection handles whenever Visual Basic is in design mode (whenever the Visual Basic programming environment is active). When a program is running, however, the user will not be able to move interface elements unless you have changed a special property in the program to allow this. You’ll practice moving and resizing the command button now.
Move and resize a command button
Drag the command button to the right by using the mouse.
The command button snaps to the grid when you release the mouse button. The form grid is designed to help you edit and align different user interface elements. You can change the size of the grid by clicking the Options command on the Tools menu and then clicking the General tab.
- Position the mouse pointer on the lower-right corner of the command button.
The grid helps you design your user interface.
When the mouse pointer rests on a corner or a side of a selected object, it changes into a sizing pointer. You can use the sizing pointer to change the shape of an object.
- Enlarge the object by holding down the left mouse button and dragging the pointer down and to the right.
When you release the mouse button, the command button changes size and snaps to the grid.
- Use the sizing pointer to return the command button to its original size, and then move the button back to its original location on the form.
Now you’ll add a second command button to the form, below the first button.
Add a second command button
Click the CommandButton control in the toolbox.

CommandButton control
Draw a command button below the first button on the form. (For consistency, create a command button of the same size.)
- Move or resize the button as necessary after you place it. If you make a mistake, feel free to delete the command button and start over.
You can delete an object by selecting the object on the form and then pressing Del.
next page....
|