|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
vbc : error BC30420: 'Sub Main' was not found in 'Product'.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 "Learner" <pra***@gmail.com> schrieb: Your application needs an "entry point", where execution starts.> 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 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/> 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: Show quoteHide quote > "Learner" <pra***@gmail.com> schrieb: > > 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/> 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: Show quoteHide quote > "Learner" <pra***@gmail.com> schrieb: > > 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/> "Learner" <pra***@gmail.com> schrieb: Ooops, yes, I forgot 'Imports System' on top of the file.>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? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Why does this not work? What am I doing wrong?
PrintDocument_PrintPage goes into endless loop until e.HasMorePages=False Print font not available after assigning PrinterName Goodbye microsoft.public.dotnet.languages.vb MySQL and MyOleDB Rename registry Key [folder/ branch] regex expressions Deleting controls How to get the checked columns in DataGridView Webbrowser |
|||||||||||||||||||||||