Click here to Skip to main content
15,446,232 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am making a POS system and I am using multiple forms. If I press the close button on one of the later opened forms from the start form it doesn't stop the project.

I think I need a way to do 'x.close()' for all active forms but I'm unsure.

I am using VB.net 5.0 with windows forms

TIA
Ben :)

What I have tried:

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
 Me.Close()
End Sub
Posted
Comments
Jo_vb.net 11-Nov-21 9:23am     CRLF
Application.Exit() stops / closes all
Ben 711 Gaming 11-Nov-21 9:24am    
How do i make this run when the user presses the X button?
Jo_vb.net 11-Nov-21 9:28am     CRLF
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing Application.Exit() End Sub
Ben 711 Gaming 11-Nov-21 9:54am    
This helps thank you. Would you also know how to cancel a close after pressing the X also?
Jo_vb.net 11-Nov-21 10:00am     CRLF
Take an example from the web like https://www.freevbcode.com/ShowCode.asp?ID=5745 and add Application.Exit()

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900