How to Get a Response From a Message Box in VB.Net
The VB.NET InputBox class lets you display a dialog window to your readers and retrieve the input sent by the user. The retrieved input is set as a VB.NET string variable, and you can process the information with any other form input. Input boxes in VB.NET allow programmers to set up a separate window for important information before sending the data to a separate processing file.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click "Microsoft .NET Framework," then click "Visual Studio." Open your VB.NET project.
-
2
Double-click the code file in Solution Explorer on the right panel. The file opens to the VB.NET editor where you create the InputBox class object.
-
-
3
Create the variable for the user's input. The following code creates a VB.NET input variable:
Dim input As String
-
4
Create the input box popup dialog. The following code displays the popup for the user:
input = InputBox("Please enter a color", "Colors", "Blue")
The example above asks the user for a color, and the default color "Blue" is displayed. The value entered by the user is assigned to the "input" variable.
-
1