Hi Peter,
please se below
).
"Peter Huang" said:
Hi
Based on my understanding, you have a .net winform PPC app.
The form1 is the mainform, it will show at the start of the app.
After that , you will do something e.g. click a button to show a second
form2 as modal(showdialog)
If we switch to another application and then switch back the form1 will
show, but since the focus is held by form2, it will be disabled. [FML] Correct!!
If I have any misunderstanding, please feel free to post here.
Also from your descritption, you have just one application with two forms,
so I am strange that you can see form1 and form2 as two app in the memory
manager.
Did I missing something?
[FML] I can se both form1 and form2 in the memory manager under running
programs.!
Also can you show your code with detailed reproduce steps for us to
reproduce the problem.
[FML]
Comment to the sourcecode:
If I click button1 (button1_Click) then I don't get the error, but if I
click button2 (button2_Click), that use the 'global myForm2' the problem
occurred.
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
public Form2 myForm2 = new Form2();
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#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>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
//
// button1
//
this.button1.Location = new System.Drawing.Point(70, 70);
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(66, 112);
this.button2.Text = "button error";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.ClientSize = new System.Drawing.Size(158, 155);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.MinimizeBox = false;
this.Text = "Form1";
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
Form1 f = new Form1();
Application.Run(f);
}
private void button1_Click(object sender, System.EventArgs e)
{
(new Form2()).ShowDialog();
}
private void button2_Click(object sender, System.EventArgs e)
{
myForm2.ShowDialog();
}
}