bradywadywoo
New Member
- Joined
- May 2, 2011
- Messages
- 1
Hello i have come accross a problem i used on error goto line 1 which shows a error message i will show the code please help if you answer just remember im quiet new to visual basics and will need a bit of explaining:
Module Module1
PLEASE HELP ASAP
THANKS SO MUCH
Brad,
Module Module1
Code:
Sub Main()
1: Console.Clear()
Console.Write("Simple Caclulator")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Select and option from the menu below by typing the corresponding number and pressing enter")
Console.WriteLine()
Console.WriteLine()
Console.Write("1. All Calculation will be answered in Integer mode")
Console.WriteLine()
Console.Write("2. All Calculations wil be answered in Decimal mode")
Console.WriteLine()
Console.Write("3. Exit")
Console.WriteLine()
Console.WriteLine()
Console.Write(" Please enter and option:")
Dim Uoption As String
Uoption = Console.ReadLine
If IsNumeric(Uoption) = False Then
4: Console.Clear()
Console.Write("Please select a valid option.")
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
GoTo 1
End If
If Uoption = 1 Then
GoTo 2
End If
If Uoption = 2 Then
GoTo 3
End If
If Uoption = 3 Then
End
End If
2: Console.Clear()
Console.Write("Simple Calculator: Integer Mode")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Select and option from the menu below by typing the corresponding number and pressing enter")
Console.WriteLine()
Console.WriteLine()
Console.Write("1.Addition")
Console.WriteLine()
Console.Write("2.Subtraction")
Console.WriteLine()
Console.Write("3.Division")
Console.WriteLine()
Console.Write("4.Multiplication")
Console.WriteLine()
Console.Write("5.Exit")
Console.WriteLine()
Console.Write("6.Change Calculator Mode")
Console.WriteLine()
Console.WriteLine()
Console.Write("Please enter and option:")
Dim Uchoice As Integer
On Error GoTo 4
Uchoice = CInt(Console.ReadLine)
If IsNumeric(Uchoice) = False Then
Console.Clear()
Console.Write("Please select a valid option.")
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
GoTo 1
End If
If Uchoice = 1 Then
On Error GoTo 4
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Addition")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Integer
value1 = CInt(Console.ReadLine)
Console.Write("What would you like to add to {0}? {0} + ", value1)
Dim value2 As Integer
value2 = CInt(Console.ReadLine)
Dim answer As Integer
answer = value1 + value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} + {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
On Error GoTo 4
If Uchoice = 2 Then
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Subtraction")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Integer
value1 = CInt(Console.ReadLine)
Console.Write("What would you like to subtract {0} by? {0} - ", value1)
Dim value2 As Integer
value2 = CInt(Console.ReadLine)
Dim answer As Integer
answer = value1 - value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} - {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
On Error GoTo 4
If Uchoice = 3 Then
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Division")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Integer
value1 = CInt(Console.ReadLine)
Console.Write("What would you like to divide {0} by? {0} / ", value1)
Dim value2 As Integer
value2 = CInt(Console.ReadLine)
Dim answer As Integer
answer = value1 + value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} / {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
On Error GoTo 4
If Uchoice = 4 Then
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Multiplication")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Integer
value1 = CInt(Console.ReadLine)
Console.Write("What would you like to multiply {0} by? {0} * ", value1)
Dim value2 As Integer
value2 = CInt(Console.ReadLine)
Dim answer As Integer
answer = value1 + value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} * {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
3: Console.Clear()
Console.Write("Simple Calculator: Integer Mode")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Select and option from the menu below by typing the corresponding number and pressing enter")
Console.WriteLine()
Console.WriteLine()
Console.Write("1.Addition")
Console.WriteLine()
Console.Write("2.Subtraction")
Console.WriteLine()
Console.Write("3.Division")
Console.WriteLine()
Console.Write("4.Multiplication")
Console.WriteLine()
Console.Write("5.Exit")
Console.WriteLine()
Console.Write("6.Change Calculator Mode")
Console.WriteLine()
Console.WriteLine()
Console.Write("Please enter and option:")
Uchoice = CDec(Console.ReadLine)
On Error GoTo 4
If IsNumeric(Uchoice) = False Then
Console.Clear()
Console.Write("Please select a valid option.")
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
GoTo 1
End If
If Uchoice = 1 Then
On Error GoTo 4
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Addition")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Decimal
value1 = CDec(Console.ReadLine)
Console.Write("What would you like to add to {0}? {0} + ", value1)
Dim value2 As Decimal
value2 = CDec(Console.ReadLine)
Dim answer As Decimal
answer = value1 + value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} + {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
If Uchoice = 2 Then
On Error GoTo 4
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Subtraction")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Decimal
value1 = CDec(Console.ReadLine)
Console.Write("What would you like to subtract {0} by? {0} - ", value1)
Dim value2 As Decimal
value2 = CDec(Console.ReadLine)
Dim answer As Decimal
answer = value1 - value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} - {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
If Uchoice = 3 Then
On Error GoTo 4
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Division")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Decimal
value1 = CDec(Console.ReadLine)
Console.Write("What would you like to divide {0} by? {0} / ", value1)
Dim value2 As Decimal
value2 = CDec(Console.ReadLine)
Dim answer As Decimal
answer = value1 + value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} / {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
If Uchoice = 4 Then
On Error GoTo 4
Console.Clear()
Console.Write("Simple Calculator: Integer mode: Multiplication")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.Write("Please Enter your first value:")
Dim value1 As Decimal
value1 = CDec(Console.ReadLine)
Console.Write("What would you like to multiply {0} by? {0} * ", value1)
Dim value2 As Decimal
value2 = CDec(Console.ReadLine)
Dim answer As Decimal
answer = value1 + value2
Console.WriteLine()
Console.WriteLine()
Console.Write("{0} * {1} = {2}", value1, value2, answer)
Console.WriteLine()
Console.WriteLine()
Console.Write("Please press enter to go back to the main menu.")
Console.ReadLine()
Console.Clear()
GoTo 1
End If
End Sub
End Module
PLEASE HELP ASAP
THANKS SO MUCH
Brad,
Last edited by a moderator: