What is the meaning of below code : ?


Please let me know the meaning of below code :


<STAThread()> _                                  'Meaning required
Public Shared Sub Main()

      Application.Run(New Form1)

End Sub

Thanks,
Kishore

kishore_peddiAsked:
Who is Participating?
 
arif_eqbalCommented:
STA stands for Single Threaded Apartment
Its a threading model you can read about it in the link provided above.

<STAThread()>   is an attribute of the method Main, this is used to specify some special attribute of the method/property etc. in .NET

Now main is a shared method that is (apparantly) going to be the Entry Point of the Application. When this main is executed it needs to start a Message Loop for the current application. To do this we Use Application.Run, this takes an argument the instance of the form to show.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.