Results 1 to 5 of 5

Thread: Add form to project and make it the startup form?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    Add form to project and make it the startup form?

    Hello,

    I created a project with buttons, textboxes, etc... and ran it. Then I added a new form that will be a splash screen. How do I make the splash screen form startup first?

    Thanks!

  2. #2
    Lively Member JAtkinson's Avatar
    Join Date
    Feb 2004
    Location
    Richmond, VA
    Posts
    68
    I know exactly what you're talking about. Ive had this happen to me many times. When I went to the Project Settings and tried to select a new form as the startup, it wasnt there. I am also unsure of how to fix this. It seems to be random.


    James
    Visual Studio .net 2003 EA
    VB .net
    C#

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You need a main method in the startup form (although, I haven't tried it, I don't think it matters which form it is in). Look through the start up form right now, find the Main method, and you just need to cut it, paste it into the form you want to start. (Make sure you adjust the Application.Start(Form1) call).

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Looks something like this:
    static void Main()
    {
    Application.Run(new MainForm());
    }

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    Thanks. I had noticed that, but when I messed with it would not work. I basically removed that from the intial main form and then pasted it into the splash form and then selected the splash form as startup (now that it shows up). Here is a clip of the code relating to where it goes.

    #region Windows Form Designer generated code
    /// <summary>
    Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    </summary>
    ///

    [STAThread]
    static void Main()
    {
    Application.Run(new frmSplash());
    }

    private void InitializeComponent()
    {
    this.components = new System.ComponentModel.Container();
    this.Size = new System.Drawing.Size(300,300);
    this.Text = "frmSplash";
    }
    #endregion

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width