Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Creating a Dialog Box
◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Creating a Dialog Box
■ A dialog box is a standard form that either request information from the
user, provide information to the user, or both.
See: ◄Form► ◄INPUTBOX$ Function► ◄MSGBOX Statement► ◄MSGBOX Function►
■ Dialog boxes are typically used for the File Open command. For example:
░░░░░░░░░░░░░░░░░File Open░░░░░░░░░░░░░░░░░░
│ ┌─────────────────┐ ╔════════╗│
│ File Name: │ *.BAS │ ║ OK ║│
│ └─────────────────┘ ╚════════╝│
│ ┌────────┐│
│ Files: Directories: │ Cancel ││
│ ┌──────────┐ ┌──────────┐ └────────┘│
│ │ TEST.BAS │ │ .. │ Drives: │
│ │ │ │ MYPROGS │ ┌──────────┐ │
│ │ │ │ VBSTUFF │ │ [-C-] │ │
│ └──────────┘ └──────────┘ └──────────┘ │
└──────────────────────────────────────────┘
■ To create a dialog box:
• Create and size a form
• Draw the controls
• Define event procedures
See: ◄Designing Forms► ◄Drawing a Control► ◄Creating an Event Procedure►
■ In Visual Basic, standard characteristics for dialog boxes include:
Dialog Item Control Properties and Settings
══════════════════ ═══════════════════════════════════════════
A nonsizable form BorderStyle = 1 (Fixed Single), 3 (Fixed
Double), or 5 (Fixed Solid)
No control box ControlBox = 0
No Minimize button MinButton = 0
No Maximize button MaxButton = 0
OK button Command button with Default = True (-1)
Cancel button Command button with Cancel = False (0)
See: ◄BorderStyle Property► ◄Command Button Control►
◄MaxButton Property► ◄MinButton Property►
■ To display a dialog box, use the SHOW method; to remove the dialog, use
either the HIDE method or the UNLOAD statement. For example:
FUNCTION FileName$()
frmFileOpen.SHOW 1
FileName$ = frmFileOpen.txtFileName.Text
UNLOAD frmFileOpen
END FUNCTION
See: ◄HIDE Method► ◄UNLOAD Statement►