Question: Using the InputBox Function Note: The InputBox function's syntax also includes optional XPos and YPos arguments for specifying the dialog box's horizontal and vertical positions,

Using the InputBox Function
Note: The InputBox function's syntax also includes optional XPos and YPos arguments for
specifying the dialog box's horizontal and vertical positions, respectively. If both arguments are
omitted, the dialog box appears centered on the screen.
Basic syntax
InputBox(prompt[, title][, defaultResponse])
Example 1.
strSales =
InputBox("Enter a sales amount. Click Cancel to end.",
"Sales Entry", "0.0")
Displays the input dialog box shown in Figure B-5. When the user closes the dialog box, the
assignment statement assigns the function's return value to the strSales variable.
Example 2
strCity = InputBox("City name:", "City")
Displays an input dialog box that shows "City name:" as the prompt, "City" in the title bar, and
an empty input area. When the user closes the dialog box, the assignment statement assigns
the function's return value to the strCity variable.
Example 3
Const strPROMPT As String = "Enter the discount rate:"
Const strTITLE As String = "Discount Rate"
strRate = InputBox(strPROMPT, strTITLE, ".00")
Displays an input dialog box that shows the contents of the strPROMPT constant as the prompt,
the contents of the strTITLE constant in the title bar, and .00 in the input area. When the
user closes the dialog box, the assignment statement assigns the function's return value to the
strRate variable.
Example 4
Integer.TryParse(InputBox("How old are you?",
"Discount Verification"), intAge)
Displays an input dialog box that shows "How old are you?" as the prompt, "Discount Verification"
in the title bar, and an empty input area. When the user closes the dialog box, the TryParse
method converts the function's return value from String to Integer and then stores the result in
the intAge variable.
Can you describe another situation when the InputBox Function could be used? Why would
the function be helpful? What would it achieve? Create an example like the ones shown in
the figure above and include it with your response.
 Using the InputBox Function Note: The InputBox function's syntax also includes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!