i am new in vb.net..
i have started simple progamming in vb.net
in some places i have seen
Shared Sub Main()
or
Sub Main()
what is this...? what is the meaning of shared here?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaish MathewsRank #225 · 11K reputationPosted Jul 17, 2010, 9:20 AM EDT
C# Static = VB.NET Shared
Both key word meant for single copy for any number of object instance rather than each object has it's own copy.
In console application, one automatic entry point needed as these applications are normally GUI free. More over this entry point won't call explicitly, but initiated automatically. So only once instance of this method needed as no user is going to create an object and call this Main() explicitly.
Sam HobbsRank #107 · 20.5K reputationPosted Jul 17, 2010, 12:32 PM EDT
In VB.Net, if Main is in a class then you must use Shared else you don't have to use Shared. Otherwise my explanation in your other thread is relevant here too.