Activate the wrong form on Pocket PC csharp .Net

G

Guest

I have a problem when switching between another program and my own
application.

this is what happens:

1) I start 'myapp.exe" from File Explorer
2) From form1 activate 'ShowDialog()' on form2
3) Start File Explorer and reactivate 'myapp.exe' by clicking the exe file.
4) Now form1 is showed and not the last active form form2. And the
application is 'disabled'.
5) However I can reactivate the correct form2 by going to memory manager and
reactivate form2, from the "Running program list".

I'am using Compact Framework with SP3.

I can send a sample program..!

/Flemming
 
P

Peter Huang [MSFT]

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.

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?

Also can you show your code with detailed reproduce steps for us to
reproduce the problem.

Thanks.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi Peter,

please se below :blush:).

"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();
}
}
 
P

Peter Huang [MSFT]

Hi

Thanks for your quickly reply!

I can reproduce the problem.
Now I am researching the issue, and I will update you with new information
ASAP.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi

So far I am contacting related Embeded supporting team engineer.
I will update you with new information ASAP.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi

Thanks for your quickly reply!
I will update you with new information ASAP.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi

Our embeded engineer has confirmed the problem and he is still researching
the issue.
If I got any new information, I will update you ASAP.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi

I am sorry for delay reply.
So far we have reported the issue to our product team, it may take a period
of time.
Per the workaround that declare the form variable inside the method that
you provide, did you have any concern?
If so, please feel free to post here about your concern about the
workaround, and what is your application design so that we can try to see
if there is another solution.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi,

I'm sad to hear that there is no workaround (beside that declare the form
inside the method), because our application is reusing the forms like some
kind of ‘singelton’ design (static Forms).

Don’t you have any other suggestion, it is a big problem for our application
usability..!?

/Flemming
 
P

Peter Huang [MSFT]

Hi

Based on my research, I think you may try to decare the formdialog var in
the class but create the instance in the InitializeComponent method.
e.g.
public FormDialog fm = null;
void InitializeComponent ()
{
fm = new FormDialog();
}

If you still have any concern, can you describe your scenario more
detailed, so that we can understanding your question more detailed.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi,

will the error be fixed in the upcomming version of compact framework or !?

/Flemming
 
P

Peter Huang [MSFT]

Hi

We have reported the problem to our product team, and they have aware of
the problem. We will considerately fix the problem in our next release.
But since the next version of compact framework is not final released, it
is still in beta test period, we can not gurantee if the behavior will be
changed or fixed.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi,

I have been very busy, so sorry that I haven’t written back to you before
now. I do not have the time to look at the problem the next 1-2 weeks, but I
will come back to you when I again have the time. Is this okay with you or?

/Flemming
 
P

Peter Huang [MSFT]

Hi

Ok, if so we can achieve the problem and you may reopen it when necessary.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi

I am sorry if I did not make it clear.
You can either open a new thread(if the thread is too long) or just post in
the thread.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Hi,

do you know if the problem will be fixed in the new release of Compact
Framework.

best Flemming
 
P

Peter Huang [MSFT]

Hi Emicati,

Thanks for your response.
I have reported the issue, and our dev team will plan to fix it.
But I can not guarantee if the problem will be fixed in the next release of
Compact Framework.

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top