What is the meaning of below code : ?

Posted on 2005-04-17
Medium Priority
Last Modified: 2010-04-23

Please let me know the meaning of below code :

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

      Application.Run(New Form1)

End Sub


Question by:kishore_peddi
LVL 13

Expert Comment

ID: 13802742
LVL 19

Accepted Solution

arif_eqbal earned 750 total points
ID: 13814376
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.


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question