Hello everyone! I've just started learning VB and have been trying to figure this out all day now. I need to construct a simple program that multiplies numbers, which I know how to do just fine, but I also need to show an error message if anything other than a number is entered. That's the part I'm stuck on. Thanks in advance.
Public Class Form1
Private Sub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
Dim A As Boolean
Dim num1 As String
Dim num2 As String
num1 = TextBox1.Text
num2 = TextBox2.Text
MsgBox(Val(num1 * num2))
If A = IsNumeric(num1 * num2) Then
ElseIf IsNumeric(num1 * num2) = False Then
MsgBox("Error")
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Public Class Form1
Private Sub btnsubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
Dim A As Boolean
Dim num1 As String
Dim num2 As String
num1 = TextBox1.Text
num2 = TextBox2.Text
MsgBox(Val(num1 * num2))
If A = IsNumeric(num1 * num2) Then
ElseIf IsNumeric(num1 * num2) = False Then
MsgBox("Error")
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class