Form Closing
-
I am trying to use the following code to make sure all codes are closed when clicking the x in the top right hand corner. --- Private Sub frmTestTop_FormClosing(ByVal sender As Object, ByVal e As system.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing me.close End Sub --- It is however coming up with an dll stock overflow error, what am i doing wrong? Is there an easier way to do this??? Cheers
-
I am trying to use the following code to make sure all codes are closed when clicking the x in the top right hand corner. --- Private Sub frmTestTop_FormClosing(ByVal sender As Object, ByVal e As system.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing me.close End Sub --- It is however coming up with an dll stock overflow error, what am i doing wrong? Is there an easier way to do this??? Cheers
-
if u wanna close alll your forms, you can just put a close button on your form and code application.exit() or End in its clickin event .. thats it....
Its the close button in the control box, which when you click it just closes the current form, not any that may be hidden. Any ideas? Its in vb.net 2005 btw
-
I am trying to use the following code to make sure all codes are closed when clicking the x in the top right hand corner. --- Private Sub frmTestTop_FormClosing(ByVal sender As Object, ByVal e As system.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing me.close End Sub --- It is however coming up with an dll stock overflow error, what am i doing wrong? Is there an easier way to do this??? Cheers
Application.Exit() ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I am trying to use the following code to make sure all codes are closed when clicking the x in the top right hand corner. --- Private Sub frmTestTop_FormClosing(ByVal sender As Object, ByVal e As system.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing me.close End Sub --- It is however coming up with an dll stock overflow error, what am i doing wrong? Is there an easier way to do this??? Cheers
The reason you are getting a Stack Overflow Error is because in your code,
FormClosing
allows you to perform last minute steps before the app shuts down. So when your app tries to close, you callMe.Close()
which loops back and calls the same function continually. I hope that makes since.
Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.
-
The reason you are getting a Stack Overflow Error is because in your code,
FormClosing
allows you to perform last minute steps before the app shuts down. So when your app tries to close, you callMe.Close()
which loops back and calls the same function continually. I hope that makes since.
Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.
Yeah i get it. The reason i am trying to use it, is because the first form, i want to show another one and CLOSE the original form, however, when i close the first form, the whole program closes, so i had to hide it to get around this. Is there any way to get around this??? Sorry to bother you all, I'm just really stuck and its annoying!!
-
Yeah i get it. The reason i am trying to use it, is because the first form, i want to show another one and CLOSE the original form, however, when i close the first form, the whole program closes, so i had to hide it to get around this. Is there any way to get around this??? Sorry to bother you all, I'm just really stuck and its annoying!!
Well you can just hide the first form (
Me.Hide()
), and then when you want to close all the forms, useApplication.Exit()
.
Trinity: Neo... nobody has ever done this before. Neo: That's why it's going to work.
-
Yeah i get it. The reason i am trying to use it, is because the first form, i want to show another one and CLOSE the original form, however, when i close the first form, the whole program closes, so i had to hide it to get around this. Is there any way to get around this??? Sorry to bother you all, I'm just really stuck and its annoying!!
well i think if first form is hidden by using me.hide(), then u wont be able to close it through form2(or your most active form)using that cross button in controll box. and even if you could then why to increase complexity. jst hide yr form one and close yr succesive forms by me.close and appliction.exit on the last form will be the easiest way... try it out...
-
Application.Exit() ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
I hadn't ever heard of that one either, but it really exists... :omg:
My advice is free, and you may get what you paid for.