hadling multiple forms

Sep 15 2010 12:24 PM
Hi all,
Need a little help!!!

I want to create an windows application such that there are 2 forms:
form1 and form2

i want the form2 to be in background of form1 and form2 should be never seen(even when form1 is minimised,maximised,resized and if some other application is opened).

code i have used is:

Form2 obj = new Form2();
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
obj.Show();
}

private void Form1_Move(object sender, EventArgs e)
{
obj.Location = this.Location;
}

private void Form1_Resize(object sender, EventArgs e)
{
obj.Size = this.Size;
if (this.WindowState == FormWindowState.Minimized)
{
obj.Hide();
}
if (this.WindowState == FormWindowState.Normal)
{
obj.Show();
}

}


all the forms should be modeless dialogs(using show() function)


Using this, sometimes, i get the form2 loaded before loading form1, can this situation be avoided.? because i want the form2 always in background.

Thanks in advance.

Answers (2)