473,394 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

vbc : error BC30420: 'Sub Main' was not found in 'Product'.

Hello,

I just wanted to jump on try creating a small calss in VB.NET in a
note pad. And my class takes below lines of code

Public Class Product

Public Name as string
Private m_id as string

Public Sub New()
m_id = 0
End Sub

Public property ID() as Integer

Get
ID = M_id
End Get

Set(byVal Value as Integer)
m_id = Value
End Set

End Property

End Class

But when I run this in the command prompt I got the above error that is
mentioned in the subject line.

Now, my question is do I need to have Sub Main class to create a simple
class? I guess may be I need it when I want create an object for this
Product class and try calling its properties and methods.

Please help me understand.

Thanks
-L

Dec 25 '06 #1
4 33116
"Learner" <pr****@gmail.comschrieb:
I just wanted to jump on try creating a small calss in VB.NET in a
note pad. And my class takes below lines of code
Your application needs an "entry point", where execution starts.

I suggest to add a class with a shared main sub:

\\\
Public Class Program
Public Shared Sub Main()
Console.WriteLine("Hello World")
End Sub
End Class
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Dec 25 '06 #2
Hello,

Thanks for the quick response.

Is this some thing like this?

Public Class Product
Public shared sub Main()
Public Name as string
Private m_id as string

Public Sub New()
m_id = 0
End Sub

Public property ID() as Integer

Get
ID = M_id
End Get

Set(byVal Value as Integer)
m_id = Value
End Set

End Property
End sub
End Class

Can you help modify my program?

Thanks
-L
Herfried K. Wagner [MVP] wrote:
"Learner" <pr****@gmail.comschrieb:
I just wanted to jump on try creating a small calss in VB.NET in a
note pad. And my class takes below lines of code

Your application needs an "entry point", where execution starts.

I suggest to add a class with a shared main sub:

\\\
Public Class Program
Public Shared Sub Main()
Console.WriteLine("Hello World")
End Sub
End Class
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Dec 25 '06 #3
I just tried simply your few lines of code but it said "Console" is not
declared. Do I need to import any kind of namespace?

Thanks
-L
Herfried K. Wagner [MVP] wrote:
"Learner" <pr****@gmail.comschrieb:
I just wanted to jump on try creating a small calss in VB.NET in a
note pad. And my class takes below lines of code

Your application needs an "entry point", where execution starts.

I suggest to add a class with a shared main sub:

\\\
Public Class Program
Public Shared Sub Main()
Console.WriteLine("Hello World")
End Sub
End Class
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Dec 25 '06 #4
"Learner" <pr****@gmail.comschrieb:
>I just tried simply your few lines of code but it said "Console" is not
declared. Do I need to import any kind of namespace?
Ooops, yes, I forgot 'Imports System' on top of the file.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Dec 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Bruneau | last post by:
Hi Folks, I wonder what I need to do. I make a REAL simple design, One losuy form that has an allocated 'Name' property - Form1 I build solution without an issue.
8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
2
by: Julia Baresch | last post by:
Hi everyone, As some of you may know, we've been having trouble with an unrecognized database format error. Today I installed an unfinished project on the workstation of one of my users. ...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
3
by: vengala s reddy | last post by:
VBC :error BC30420: BC 'SubMain' was not found in 'MyTime.dll'. I am trying to do is compiling a simple program like this NameSpace Temperature Public Class TemparatureCB Inherits...
0
by: Ralf Gedrat | last post by:
Hello! I have a Application, this throws after some time following exception: Item has already been added. Key in dictionary: "- 1" key being added: "- 1" I use Application.Run with...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
11
by: TinaJones095 | last post by:
Hello I am going to give a program that I have done, but I have to modifiy it, but I need help okay can you help ? Here the program I need help to straighten up below: the Java error is right at...
10
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.