|
The InputBox() function is very similar
to the MsgBox() function. The
major difference being is that
the InputBox() function receives answers
that are more complete than the MsgBox()
function , The InputBox()
function returns a string data value
that holds the answer that was typed
in by the user.
The syntax of the InputBox( ) function
is similar to the MsgBox( ) function
, here is the syntax below
strVariable = InputBox( strPrompt
[, [strTitle] [, strDefault]
[, intXpos, intYpos]]]
You will notice immediately that
an InputBox returns a string and not
an integer , strPrompt is the only
required argument and what this does
is display the prompting text inside
the box , the strTitle is the caption
that is displayed in the title bar
, if left out it defaults to the project
name .
strDefault is used to display default
text in the InputBox you could use
this for example to display a default
name and then ask the user to input
theirs.
intXpos and intYpos are used to specify
the exact position in which your input
box would appear relative to the form
intXpos is the position from the left
edge of the form and intYpos is
the position from the Top edge
of the form . The unit of measurement
is twips and their are 1440 twips
per inch or 567 to a centimetre .
If these are missed out the InputBox
is centered on the form by default.
Input boxes always contain Ok and
Cancel buttons .
Lets see an example of all this ,
here is the code I used.
strReturn = InputBox("What is
your name ?" ,"Enter name"
,"Iain" )
Here is what was displayed on running
the program

You will notice I omitted the position
arguments in the example above
|