thegreatone
Mar 24th, 2006, 11:05 PM
Ok, this is really embarrassing, but i'm new to C# and i'm just porting over an application from VB (It's the first EVER port i've done, going smoothly actually)
I'm stuck on form manipulation so to speak, whenever my start-up form is closed, even if i open another form my appliacation exits, is this standard behaviour in the C# environment ? if so, is there a way around it ?
The first form to load is labelled "Form2" and shortly after i launch either Form1, or Form3, depending on a users choice. However when i try and open Form1 or 3 and close Form2, my entire application closes.
Here is my start...
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WindowsApplication1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form frm2 = new Form2();
Application.Run(frm2);
}
}
}
And when my Form2 closes this is how...
private void label3_Click(object sender, EventArgs e)
{
Form1 frm = new Form1();
frm.Show();
this.Close(); //For some reason it closes the entire application, not just the form, as documented.
}
Any help would be appreciated. :thumb:
I'm stuck on form manipulation so to speak, whenever my start-up form is closed, even if i open another form my appliacation exits, is this standard behaviour in the C# environment ? if so, is there a way around it ?
The first form to load is labelled "Form2" and shortly after i launch either Form1, or Form3, depending on a users choice. However when i try and open Form1 or 3 and close Form2, my entire application closes.
Here is my start...
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WindowsApplication1
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form frm2 = new Form2();
Application.Run(frm2);
}
}
}
And when my Form2 closes this is how...
private void label3_Click(object sender, EventArgs e)
{
Form1 frm = new Form1();
frm.Show();
this.Close(); //For some reason it closes the entire application, not just the form, as documented.
}
Any help would be appreciated. :thumb: