|
-
Mar 25th, 2006, 12:05 AM
#1
Thread Starter
Frenzied Member
[2.0] Forms Question.
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...
Code:
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...
Code:
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|