Main Menu

HOME

.Net
ASP
Assembly
C
C++
Delphi
HTML
Java
JavaScript
MySQL
PC interface
Powershell
Perl
PHP
VBScript
Visual Basic
XML

Make money selling software. Check this out here

Hosted clickbank mall. Check this out here




   Misc

   Amazon

   Links

    


Input Boxes
 

 

 

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


 

 

 

 




   Sponsors
 

   Software
500 Java Tips E-book
PHP editor
PERL editor
Beginning Java
Beginning Visual Basic
Learn VB.net
Learn VB 6
VB and databases
ASP image library
C++ builder programming
C++ fundamentals

   Source Code
find a string in another(PHP)
list all fonts in the windows\fonts folder(VBScript)
Screen resolution(VB)
Open/Close CD door example(VB)
color chooser(Javascript)
disable CTRL + ALT + DEL(VB)
Open a file and display contents(C++)
dial a number(VB)

    




Copyright © 2003 by programmershelp.co.uk