- 1). Launch Microsoft Visual Basic Express and click "New Project" on the left pane of your computer screen. Click "Visual Basic" below "Installed Templates," click "Windows Forms Application" and click "OK" to start a new project.
- 2). Double-click the "TextBox" control on the "Toolbox" pane to add one to your form. Add a "Button" using the same technique.
- 3). Double-click the button to create a button click event, and add the following code to create two variables:
Dim numericCheck As Boolean
Dim inputTxt As String - 4). Type the following code to get the value entered in the textbox and check if it's numeric using the "IsNumeric" function:
inputTxt = Me.TextBox1.Text
numericCheck = IsNumeric(inputTxt) - 5). Add the following code using the Boolean variable and let the user know if the value was numeric:
If numericCheck Then
MsgBox("You entered a numeric value.")
Else
MsgBox("You did not enter a numeric value.")
End If - 6). Press "F5" to run the code and click "Button1."
next post