Form (2) – Adding Controls

Then we add some elements to our form.

We begin with a text box. Select the “text box” element (1) in the toolbox and click and drag in the form (2). If you have the desired size, release the mouse button. You can of course still change the text box by selecting it again and dragging the blocks on the edge of the text box.
Then give the text box an appropriate Name (3).

Start a text box with the letters txt always, you know what type of object it is when you read the VB code. In this case txtNaam seems a good choice.


We place a caption for a text box, better known as a label, otherwise the user will not know what he must complete.

Select the element ‘Label’ (1) and click and drag in the form.

In the Name box, I suggest that you give the label an appropriate name. For a caption I always start with the letters LBL, abbreviation of label. You do not have to place these letters there, but again, in the VB code it is much clearer when you do so.

To adjust the properties for the layout of the label, we use the font and font size, text color and the label height (3).

We do the same for the data “address”, “postcode”, “town” and “Tel#”.
Remember to give a name (Name) to every item you place in the form.

Then we have this:

What remains now is to place our two buttons on the form.

One to add the information you submit on the form, to the table.
And other to close the form.

For this, select the element “Command Button” and click and drag in the form.

Give the button a (Name), a command button I always start with the letters cmd, abbreviation of command. It’s just a habit.

And give it a corresponding text in the “Label”.

For the close button, I give the cmdClose for the (name) and “Close” for the “Label”.

The add button, I give the cmdAdd for the (name) and “Add” for the “Label”.
Eventually you can make this with the other options in the properties window.

In the next lesson we will add the VB code.


You've completed Lesson 9