132 Part II Programming Fundamentals
After InputBox has returned a text string to the program, the fourth statement in the
procedure places the user’s name in the Text property of the Label1 object, which
displays it on the form.
- Save your changes.
- Click the Start Debugging button on the Standard toolbar to run the program.
The program runs in the IDE.
- Click the Input Box button.
Visual Basic executes the Button1_Click event procedure, and the Input Box dialog box
opens on your screen, as shown here:
- Type your full name, and then click OK.
The InputBox function returns your name to the program and places it in the FullName
variable. The program then uses the variable to display your name on the form, as
shown here:
Use the InputBox function in your programs anytime you want to prompt the user for
information. You can use this function in combination with the other input controls to
regulate the flow of data into and out of a program. In the next exercise, you’ll learn
how to use a similar function to display text in a dialog box.
- Click the Quit button on the form to stop the program.
The program stops, and the development environment reappears.