I have form A
, which opens form B
after an event then hides itself. Form B
generates conditions for form A
then returns to form A
and closes itself; however, due to conflict with code, I will have to generate form A
anew lest I encounter a stackoverflow exception / my application not closing properly (due to form A
, the main form, being hidden)
This has gotten a bit confusing, essentially I've already solved this by declaring the main form as new each time, however, I wish to be able to handle first time startup events like those tutorial messages for certain applications. Without the overhead of having to create a log to store my boolean, how will I detect if it's the first time the form is opened?
Normally I would:
Event(){
bool startup;
if (startup = true) {
startup = false;
return;
}
//Rest of code
}
However, since the form is generated new each time, this will always remain true.
Here's the code:
Form A variables:
Account AccountForm = new Account();
Button event:
AccountForm.QR = this;
this.Hide();
AccountForm.ShowDialog();
Form B:
public Form QR { get; set; }
Button event:
QR = new QueryRefiner();
this.QR.Show();
this.Close();
This is all of it I think. I take the new declaration out of QR, and I would receive a StackOverflow exception. I guess I should have created a new question for this, but there it is. (I think i'm on the timer still)