Adding a User Form to Your Application

If your application requires a user interface or dialog with the user, you need to add a UserForm. A UserForm, or dialog box, is a window in which several bits of information can be gathered or displayed at once. A login dialog box is a simple example of a form, whereas the AutoCAD Select File dialog box in Figure 3-1 represents a more complex application example.

History #

Favorites

History #

Favorites

Local Disk (C:)

_fill

Ç2

Name A

SiZ' A

OASFRoot

AutoCAD VBA Source Code Exa...

ÊiBatchPIot

QBIockMan

OCodeBlockVBA

^Documents and Settings

ÛEditGrid

^Engineering Change Order

found, 000

ÊDiCommand

ODropExample

Qlnetpub

ÊD ingenious

Gi Inventor AddlnSample

ê> Inventor API

icDlnventorVBA

J

¡Shaft

<1 1

Preview-

| Select Initial View

Files of lype: |Drawing f.dwg)

| Select Initial View

Files of lype: |Drawing f.dwg)

JJjsJ

Preview-

Figure 3-1. The Select File dialog box

To add a UserForm to your project, select Insert UserForm. Alternatively, you can use a drop-down toolbar button, shown in Figure 3-2, that enables you to add these four basic components: UserForm, Module, Class Module, and Procedure.

Figure 3-2. The drop-down toolbar button showing various modules

Once you've chosen to add a UserForm to your project, your project should look something like Figure 3-3.

Figure 3-3. The AutoCAD VBAIDE
0 0

Post a comment