Adding controls to the User Form

To make the form useful, you need to add controls to the form. For this UserForm, you need the following controls:

♦ Label controls to identify the various elements on the UserForm

♦ A ComboBox control to select a resource

♦ A text box to enter the amount by which you want to increase or decrease the work for the selected resource

♦ OK and Cancel command buttons

Once you have completed the UserForm, it should look like Figure 25-12.

Label

Drop-down combo box

Label

Drop-down combo box

Text box

Command buttons

Figure 25-12: The Adjust Work dialog box, based on the completed UserForm.

Text box

Command buttons

Figure 25-12: The Adjust Work dialog box, based on the completed UserForm.

Label control

The UserForm won't be meaningful to the user unless he knows what the various controls do, so start by adding a Label control to the UserForm for the box where the user must select a resource. Click the Label button in the Toolbox to select the Label control, as shown in Figure 25-13. Then, on the UserForm, use your mouse to "draw" the control toward the upper-left corner of the form, as shown in Figure 25-14.

Text box

Text box

Drop-down combo box

Command button

Drop-down combo box

Figure 25-13: The Toolbox allows you to select the controls for the UserForm.

Command button

Figure 25-14: The Label control is displayed on the UserForm.

In the Properties window, set each of the properties for the Label control, as shown in the following table.

Property

Input

(Name)

LblResource

Caption

Select Resource:

Height

12

Left

12

Top

12

Width

60

Note The Label control has many other properties, but you can accept the default value *-""" for all the other properties.

ComboBox control

To select the resource whose work needs to be adjusted, you need a ComboBox control. Click the ComboBox button in the Toolbox, and use your mouse to "draw" the control below the Label control, as shown in Figure 25-15.

Figure 25-15: The ComboBox control is displayed on the UserForm.

In the Properties window, set each of the properties for the ComboBox, as shown in the following table.

Property

Input

(Name)

cboResource

Height

15.75

Left

12

Top

12

Style

1 - fmStyleDropDownList

Width

210

Add another Label control to the UserForm, just below the resource ComboBox control. Click the Label button in the Toolbox, and use your mouse to "draw" the Label control below the resource ComboBox control, as shown in Figure 25-16.

UserForml

• Select Resource:

1 d

(inter percent to increase or decrease work: U

Figure 25-16: The second Label control is displayed on the UserForm.

In the Properties window, set each of the properties for the Label control, as shown in the following table.

Property

Input

(Name)

IblPercent

Caption

Enter percent to increase or decrease work:

Height

12

Left

12

Top

48

Width

Add a TextBox control to the UserForm, just below the Label control that you just created. Click the TextBox button in the Toolbox, and use your mouse to "draw" the TextBox control below the second Label control, as shown in Figure 25-17.

Figure 25-17: The TextBox control is displayed on the UserForm.

Property

Input

(Name)

txtPercent

Height

15.75

Left

12

Top

60

Width

66

CommandButton control

Finally, add a CommandButton control—that represents the OK button—to the UserForm toward the bottom of the form. Click the CommandButton button in the Toolbox, and use your mouse to "draw" the control below the previous TextBox control, as shown in Figure 25-18.

Figure 25-18: The OK button is added as a CommandButton control on the UserForm.

In the Properties window, set each of the properties for the TextBox control, as shown in the following table.

In the Properties window, set each of the properties for the CommandButton control, as shown in the following table.

Property

Input

(Name)

cmdOK

Accelerator

O

Caption

OK

Default

True

Height

19

Left

114

Top

90

Width

50

Now, add a CommandButton control next to the OK button that represents the Cancel button. Click the CommandButton button in the Toolbox, and use your mouse to "draw" the CommandButton control next to the OK button, as shown in Figure 25-19.

Enter percent to increase or decrease work; . .

OK

;H '

Cancel |)

^iSUS^isfu

Figure 25-19: The Cancel button is added as a CommandButton control on the UserForm.

In the Properties window, set each of the properties for the CommandButton control, as shown in the following table.

Property

Input

(Name)

cmdCancel

Cancel

True

Caption

Cancel

Height

19

Left

174

Top

90

Width

50

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment