Results 1 to 5 of 5

Thread: Sub Main() Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    4

    Sub Main() Problem

    I am using VB.NET and I am making a Simple Addition program where it asks for two numbers and adds them together.

    When I go to build it tho it says
    'Sub Main' was not found in 'Addition.Module1'

    My code is perfect too I am positive

    Thanks

  2. #2
    Addicted Member DJ_Catboy's Avatar
    Join Date
    Jan 2003
    Location
    Suffolk, UK
    Posts
    159
    Forgive me for being rude, but how can your code be perfect if it isn't working?

    A code sample would be good here......

    DJ

  3. #3
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261

    Re: Sub Main() Problem

    Originally posted by base836ball
    I am using VB.NET and I am making a Simple Addition program where it asks for two numbers and adds them together.

    When I go to build it tho it says
    'Sub Main' was not found in 'Addition.Module1'

    My code is perfect too I am positive

    Thanks

    Go into your project properties. There should be a drop-down list box that allows you to specify the startup object. Select 'Sub Main'.
    (Note: This is the VB5/6 forum. The VB.NET forum is further down).

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2003
    Posts
    4

    Coding

    Here is my code



    Module modAddition

    Sub Main()

    'storing
    Dim firstNumber, secondNumber As String

    'Defining variables
    Dim number1, number2, sumOfNumbers As Integer

    'Recieve first number from user
    Console.Write("Enter Number:")
    number1 = Console.ReadLine()

    'Recieve second number from user
    Console.Write("Enter Number:")
    number2 = Console.ReadLine()

    'Converting()
    number1 = firstNumber
    number2 = secondNumber

    'adding both together
    sumOfNumbers = number1 + number2

    'Showing results
    Console.WriteLine("The sum is {0}", sumOfNumbers)

    End Sub

    End Module

  5. #5
    Frenzied Member <ABX's Avatar
    Join Date
    Jul 2002
    Location
    Canada eh...
    Posts
    1,622
    your right, your code looks good. But you dont have VS .NET configured to look in modAddition its looking in module1. I dont have VS .NET Installed right now but if i remember correctly (not likly) Find the Task Pane and it should say something about no startup declared or no sub main double click that an it should prompt you to fix it.

    Next time please post in the proper fourm and use the [Highlight=VB] tags when you post code.
    Tips:
    • Google is your friend! Search before posting!
    • Name your thread appropriately... "I Need Help" doesn't cut it!
    • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
    • Allways Include the Name and Line of the Exception (if one is occuring!)
    • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)


    If you think I was helpful, rate my post
    IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width