Programming input and output with Visual Basic Classic
VB Classic does not have a method to develop console applications. Visual Basic Classic was designed to build applications that run only on Windows. For simple input and output, we can use two functions:
InputBox
: Displays a string passed into the method, draws a box for the user to enter their response to the prompt, and returns the value enteredMsgBox
: Displays a message box with the string passed in
Simple interaction in Visual Basic Classic
Here is the code for a simple interaction between the user and the program in Visual Basic Classic:
Private Sub Form_Load() Dim name As String name = InputBox("What is your name?") MsgBox ("It is nice to meet you " + name) End Sub
The first line in the code declares a variable named Name
to store the value returned from the keyboard. The second line utilizes the InputBox
method to draw an input box for the...