G
Guest
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3
forms. I want allow users to move forward and backward with the forms and
retain the data users have entered. I thought I'll make the inactive forms
invisible but this is creating a memory corruption problem when user close
the form2 or form3 and not the formMain.
My main form has a Next button which makes the main form invisible and
starts a new form which I'll call form2. The form 2 has a Previous and Next
button. The previous button would make the main form visiable again. The
next button would invoke a form3. both of these buttons would make form2
invisible. The form3 has a previous button to go back to form2 vislble and
make itself invisible. User can go forward and backward with these 3 forms.
Actually, I have a boolean variable in formMain and form2 to indicate if
form2 or form3 has been created. Since my application allows them to go back
and forward with these 3 forms I only want to make form2 and form3 visible if
they're already created.
I already tried have code in the closing event of form2 and form3 to try to
close it's calling form, namely form2 or formMain. But this doesn't work,
you see, when my code sets the calling form to visible=false, it
automatically callsing the form's Closing event. So, doesn't matter what
code I put there, it will get executed when I'm just setting the form to be
not visible.
My question is, if the user is closing the application either at form2 or
form3 then how do I make sure all forms are closed? Would coding to close
the main form automatically close all the chidren form in the approperate
order? If not, how can I address this? Becuase right now it's causing
memory correuption in my application. Thanks.
forms. I want allow users to move forward and backward with the forms and
retain the data users have entered. I thought I'll make the inactive forms
invisible but this is creating a memory corruption problem when user close
the form2 or form3 and not the formMain.
My main form has a Next button which makes the main form invisible and
starts a new form which I'll call form2. The form 2 has a Previous and Next
button. The previous button would make the main form visiable again. The
next button would invoke a form3. both of these buttons would make form2
invisible. The form3 has a previous button to go back to form2 vislble and
make itself invisible. User can go forward and backward with these 3 forms.
Actually, I have a boolean variable in formMain and form2 to indicate if
form2 or form3 has been created. Since my application allows them to go back
and forward with these 3 forms I only want to make form2 and form3 visible if
they're already created.
I already tried have code in the closing event of form2 and form3 to try to
close it's calling form, namely form2 or formMain. But this doesn't work,
you see, when my code sets the calling form to visible=false, it
automatically callsing the form's Closing event. So, doesn't matter what
code I put there, it will get executed when I'm just setting the form to be
not visible.
My question is, if the user is closing the application either at form2 or
form3 then how do I make sure all forms are closed? Would coding to close
the main form automatically close all the chidren form in the approperate
order? If not, how can I address this? Becuase right now it's causing
memory correuption in my application. Thanks.