Hello to all, I have completed a class assignment and wanted to expand using an If Then module to determine if an input is either a number or a specific letter. I've been searching forums and have found several examples that I have tried to make work but am unable to succeed as of yet. The VB project is in console mode and I will attempt to cut and paste the code so you can take a look at it. Now, here's a discription of what my program is supposed to do. My program asks for numerical values to input to calculate the area of a triangle. I want to add an if then statement in the event that the input is not a number it will re-ask the user to input the number again. Here is what I have so far.
Sub Main()
Dim Number As Integer
Dim Display As String
Console.WriteLine("Please input a number")
Dim input = Console.ReadLine()
If input(Number) = True Then
Number = Val(Number)
If Number < 1 Or Number > 100 Then
If Number > 100 Then
Console.WriteLine(" The Number You entered is too high")
ElseIf Number < 1 Then
Console.WriteLine(" The Number You entered is too low")
ElseIf Number >= 1 And Number <= 100 Then
Process1.Enabled = False
End If
Else
Display = " The number you entered is not between 1 and 100"
End If
Else
Display = " You did not enter a numerical value "
End If
End Sub
How can I cut and paste what I have on VB to be the same in this forum. I used WYSIWYG and it still does not look like what I have on VB.
Thanks
Sub Main()
Dim Number As Integer
Dim Display As String
Console.WriteLine("Please input a number")
Dim input = Console.ReadLine()
If input(Number) = True Then
Number = Val(Number)
If Number < 1 Or Number > 100 Then
If Number > 100 Then
Console.WriteLine(" The Number You entered is too high")
ElseIf Number < 1 Then
Console.WriteLine(" The Number You entered is too low")
ElseIf Number >= 1 And Number <= 100 Then
Process1.Enabled = False
End If
Else
Display = " The number you entered is not between 1 and 100"
End If
Else
Display = " You did not enter a numerical value "
End If
End Sub
How can I cut and paste what I have on VB to be the same in this forum. I used WYSIWYG and it still does not look like what I have on VB.
Thanks