Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. cluless what is happening

cluless what is happening

Scheduled Pinned Locked Moved C#
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hum Dum
    wrote on last edited by
    #1

    I am getting an exception as System.InvalidOperationException, Additional Info: It is invalid to start a second message loop on a single thread. Use application.RunDialog or Form.ShowDialog. My code is:

    class cINI
    {
    [STAThread]
    static void Main()
    {
    //some code
    InitApp();
    }
    private static void InitApp
    {
    //here i m creating a form obj
    frmFirst obj = new frmFirst();
    obj.ShowDialog();
    }
    internal static void StartApp()
    {
    clsLogin = new cLogin(dbUtils); // login check form obj
    if(clsLogin.ShowLogin() == DialogResult.Ok)
    Application.Run(new frmMain());
    }
    }

    Now the frmFirst : Here On Button click event i want to call the StartApp method, so i write

    cINI.StartApp();

    M 1 Reply Last reply
    0
    • H Hum Dum

      I am getting an exception as System.InvalidOperationException, Additional Info: It is invalid to start a second message loop on a single thread. Use application.RunDialog or Form.ShowDialog. My code is:

      class cINI
      {
      [STAThread]
      static void Main()
      {
      //some code
      InitApp();
      }
      private static void InitApp
      {
      //here i m creating a form obj
      frmFirst obj = new frmFirst();
      obj.ShowDialog();
      }
      internal static void StartApp()
      {
      clsLogin = new cLogin(dbUtils); // login check form obj
      if(clsLogin.ShowLogin() == DialogResult.Ok)
      Application.Run(new frmMain());
      }
      }

      Now the frmFirst : Here On Button click event i want to call the StartApp method, so i write

      cINI.StartApp();

      M Offline
      M Offline
      michaelvdnest
      wrote on last edited by
      #2

      Check out this article[^] and see how the form (splash screen) is run on a seperate thread.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups