What is the meaning of below code : ?

Posted on 2005-04-17
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

    LVL 19

    Accepted Solution

    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

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now