You can use the ApplicationContext class to do this job:
public class CustomApplicationContext : ApplicationContext
{
Form mainForm = null;
Timer timer = new Timer();
public CustomApplicationContext(Form mainForm,Form timed):base(timed)
{
this.mainForm = mainForm;
timer.Tick += new EventHandler(SplashTimeUp);
timer.Interval = 30000;
timer.Enabled = true;
}
private void SplashTimeUp(object sender, EventArgs e)
{
timer.Enabled = false;
timer.Dispose();
base.MainForm.Close();
}
protected override void OnMainFormClosed(object sender, EventArgs e)
{
if (sender is Form1)
{
base.MainForm = this.mainForm;
base.MainForm.Show();
}
else if (sender is Form2)
{
base.OnMainFormClosed(sender, e);
}
}
}
Then in your Program.cs in Main():
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
CustomApplicationContext app = new CustomApplicationContext(new Form2(),new Form1());
Application.Run(app);
}
With this you dont need the timer in Form1,just the functionality you want it to have for the especified amount of time and it closes showing Form2 after.