Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3751698
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:06:41+00:00 2026-05-19T09:06:41+00:00

Is it possible to call Application.Run, but to not pass a form parameter, or

  • 0

Is it possible to call Application.Run, but to not pass a form parameter, or is there an alternative if there’s no form to call?

The Run method doesn’t seem to have any overloads that don’t accept a form.

For example, if I wanted to instantiate a class first, and then have that call the form, is there way to do the equivalent of:

Application.Run(myClass);

Just to clarify, I do still want the functionality that .Run() provides. That is, establish a loop to keep the application running, but instead of tracking a form, track a class or other object.

This is relating to the compact framework initially. I assume that’s why the Run method doesn’t have the overload I was looking for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:06:42+00:00Added an answer on May 19, 2026 at 9:06 am

    I’m not clear whether you want to do:

    1. You want to load your form somewhere else other than the Main()
    2. Or Run a console or service application with no UI.

    For (1):

    static void main()
    {
        //Your program starts running here<<<
    
        //Do some stuff...
        FormRunner a = new FormRunner();
        a.RunForm();
    
    } // << And ends here
    
    class FormRunner {
    
        public void RunForm() {
            Application.Run(new Form());
        }
    
        //You could call which ever form you want from here?
    } // << And ends here
    

    What you need to know is your program starts from the first line of the main and ends at the last. However, when you call Application.Run(FORM) it loads up a windows message loop for that form. Its a special loop that keeps the program still in the main and waits for events (they’re called Windows Messages in win32 API)

    And so the program does not end until the user clicks the close button. When this happens, thats when your program actually will return from its Main.

    (2) So now if you just want a pure console app with no forms:

    static void main()
    {
        AcceptInputs()
        DrawScreen()
    
        //Do something else.
        //Make sure your flow stays within the main
    
    } // << Once you come here you're done.
    
    void AcceptInputs()
    {
        while(true) {
    
            //Keep accepting input
            break; // Call break when you're done. You'll be back in the main
        }
    }
    

    I hope that helped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How can I pre-set arguments in JavaScript function call? (Partial Function Application)
Is it possible to call a constructor from another (within the same class, not
How is it possible to call a client side javascript method after a specific
I have an asp.net 2.0 web application that will run on the same web
Is it possible to call a COM API from Java (specifically the HP/Mercury Quality
Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code
Is it possible to call a JavaScript function from the IMG SRC tag to
Is it possible to call into COM objects via x86 assembly language? If so,
is it somehow possible to call a rails function or to access a rails
Is is possible to call a custom VB function, saved in the same Access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.