Search code examples
vb.net

VB.NET Build Error BC30737


I am trying to make a simple calculator program but when I build the code an error come up (BC30737) saying 'No accessible 'Main' method with and appropriate signature was found in 'Module1' and I have no clue what so ever on what is causing it or how to fix it.

It's not very good code but I was just wondering how to make it work!

Module Module1

    Public Sub Main(needsWeclome As Boolean)

        'See's if the user needs the copyright notice or not.
        If needsWeclome = True Then

            'Says welcome back to the user.
            Console.WriteLine("Welcome Back")
            Console.WriteLine(" ")

            'Skips copyright notice.
            GoTo Restart

        End If

        Call Introduction()

Restart:
        Call MethordOfCalc()
        Call PlayAgain()

        Console.ReadLine()

    End Sub

    Sub Introduction()

        'Legal stuff!
        Console.WriteLine("The Calaculator!")
        Console.WriteLine("(C) Copyright James Robinson 2017")
        Console.WriteLine("All rights reserved.")

        'Introduction and asking the user for there prefered method of calculation.
        Console.WriteLine("What is your prefered methord of the calcultions!")

    End Sub

    Sub MethordOfCalc()

Options:
        'Gives the user there of options.
        Console.WriteLine("Chose from the following below:")
        Console.WriteLine("1. Add       5. Powers")
        Console.WriteLine("2. Subtract  6. Square Root")
        Console.WriteLine("3. Multiply  7. Modulous")                       'Check Spelling of 7.
        Console.WriteLine("4. Divide    8. W.I.P xRoot")
        Console.WriteLine()

        'Puts the choice into a varible and dicides what sub to hand it over to 
        'the correct sub for the opperation.
        Dim choice As Integer = Console.ReadLine()

        If choice = 1 Then
            Call Add()
        ElseIf choice = 2 Then
            Call Subtract()
        ElseIf choice = 3 Then
            Call Muliply()
        ElseIf choice = 4 Then
            Call Divide()
        ElseIf choice = 5 Then
            Call Powers()
        ElseIf choice = 6 Then
            Call SquareRoot()
        ElseIf choice = 7 Then
            Call Modu()
        ElseIf choice = 8 Then
            Call xRoot()
        Else Console.WriteLine("Please enter a valid number")
            GoTo Options

        End If

    End Sub

    Sub Add()

        Console.Write("Enter your first number to add: ")
        Dim num1 As Decimal = Console.ReadLine()
        Console.Write("Enter the second number to add: ")
        Dim num2 As Decimal = Console.ReadLine()
        Dim ans As Decimal = num1 + num2

    End Sub

    Sub Subtract()

        Console.Write("Enter your first number: ")
        Dim num1 As Decimal = Console.ReadLine()
        Console.Write("Enter the second number: ")
        Dim num2 As Decimal = Console.ReadLine()
        Dim ans As Decimal = num1 - num2

    End Sub

    Sub Muliply()

        Console.Write("Enter your first number to multiply: ")
        Dim num1 As Decimal = Console.ReadLine()
        Console.Write("Enter the second number to multiply: ")
        Dim num2 As Decimal = Console.ReadLine()
        Dim ans As Decimal = num1 * num2

    End Sub

    Sub Divide()

        Console.Write("Enter your first number to divide: ")
        Dim num1 As Decimal = Console.ReadLine()
        Console.Write("Enter the second number to divide: ")
        Dim num2 As Decimal = Console.ReadLine()
        Dim ans As Decimal = num1 / num2

    End Sub

    Sub Powers()

        Console.Write("Enter your the numbered being powered!: ")
        Dim num1 As Decimal = Console.ReadLine()
        Console.Write("Enter the number to power " & num1 & " by: ")
        Dim num2 As Decimal = Console.ReadLine()
        Console.WriteLine(num1 ^ num2)

    End Sub

    Sub SquareRoot()

        Console.Write("Enter the number that you want the square root of: ")
        Dim num1 As Double = Console.ReadLine()
        Dim ans As Decimal = Math.Sqrt(ans)

    End Sub

    Sub Modu()

        Console.Write("Enter your first number to divide: ")
        Dim num1 As Decimal = Console.ReadLine()
        Console.Write("Enter the second number to divide: ")
        Dim num2 As Decimal = Console.ReadLine()
        Dim ans As Decimal = num1 Mod num2

    End Sub

    Sub xRoot()

        Console.WriteLine("xRoot is still in development")
        Console.WriteLine(" ")
    End Sub

    Sub PlayAgain()

        Call Main(1)

    End Sub

End Module

Thanks for the help


Solution

  • Cause:

    You changed the parameters list of the Main() method into:

    Public Sub Main(needsWeclome) As Boolean
    

    But Main() is expected to have certain fixed set of parameters, you cannot change them.

    Fix:

    If you are not sure how to revert it to previous form, just create a temporary new project of the same type and take original header of Main() from there.