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
Printable View
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
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
Quote:
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).
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
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.