I’ve some pocket pc app and i’m having a serious problem with it described here: https://stackoverflow.com/questions/472598 . While looking for a solution i tried some actually quite stupid code in Main():
[MTAThread] static void Main() { Application.Run(new Tasks()); Application.Exit(); }
and set breakpoint on exit. if i just run the application and then close the window the breakpoint is reached. if i run the application and then open another window:
private void questButton_Click(object sender, EventArgs e) { QuestionnairesWindow questWindow = new QuestionnairesWindow(); questWindow.Show(); this.Hide(); }
and then get back from it to initial window:
private void backButton_Click(object sender, EventArgs e) { Tasks tasksWindow = new Tasks(); tasksWindow.Show(); this.Close(); }
and close the initial one the same way as the first time, the Apllication.exit() code is never reached and i have an impression that the application isn’t really closed ( i can’t open it again). sorry if the description is complicated
edit: the question is – any ideas why is it behaving differently?
new Tasks()inMain()is not the same object withTasks tasksWindow = new Tasks();You got 2 objects of Tasks, so closing second, first is still present and never dies. You need to pass to
QuestionnairesWindowthe reference of currentTasks.You can do that with additional
QuestionnairesWindowconstructor:using: