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!
Printable View
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!
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
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).
Looks something like this:
static void Main()
{
Application.Run(new MainForm());
}
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