Make your own free website on
Conditional Statements Tutorial

Lesson 1
Tutorials - Page 1 - Page 2 - Page 3 - Page 4 - Page 5 - Page 6 - Page 7 - Page 8 - Page 9 - Page 10

In the next examples we want to receive a value
from the user when the program is running.
To do so we will use the InputBox command.

The InputBox command syntax is:

VariableName = InputBox ("Text to Display")

After executing this command, the variable
will get the value that the user has entered.

Put 1 Command button on your form and
enter the following code to its click event:

Dim Elvis As String
Elvis = InputBox("Please Enter your name")
Print Elvis

Run the program and click the button.

A Message Box is appearing with the
text "Please Enter your name" (Figure 1).

Figure 1

Type your name in the text box, and press OK.
Your name will be printed on the form.

Back  Forward