VBA Primer - Page II.
When you insert the form you might have noticed that another dialogue
popped up.
This is the Control Dialogue ToolBox. It look's like this :
To add a control to your form, select the desired control and click on
the form
in the position that you would like the control to be. Select the
CommandButton control (2nd row, far right) and place it on your form.
Your form should now look like this :
Now, change the properties of the command button to the following :
(Name) CommandButton1
Caption OK
Default True
Font Arial - Bold - Size 8
Accelerator O
Your button should now look like this :
The Caption property is, of course, the text that appears within the
button.
The Default property means that if Enter is selected the event procedure
asSigned to this control is triggered.
The Accelerator property is the letter of the caption that needs to be
selected,
along with the Ctrl key, to select this control.
Now add the following controls to your form and changed the properties
to the
values listed below :
Command Button
(Name) CommandButton2
Cancel True
Caption Cancel
Accelerator C
Font Arial - Bold - Size 8
The Cancel property means that if Esc is selected the event procedure
assigned to this control is triggered.
Label
(Name) Label1
Caption Choose Layer:
Font Arial - Bold - Size 8
List Box
(Name) Listbox1
Font Arial - Bold - Size 8
BackColor Yellow
You can move a control by simply dragging and dropping it. To re-size it,
just
grip the re-size boxes at the edges and corners of the control.
Now move and re-size your controls and the form until the dialogue box
looks
similar to this :
Note: Do you see how easy it is to create dialogue boxes in VBA
compared
to DCL. "What a pleasure!!!"
Now that we have got our basic dialogue box we need to make it do
something.
Page III, look out, here we come...........
|