FormClosing Event Question Programming Software Development by Darkicon …not have a minimize button. Here's the code for FormClosing and the exit option: Private Sub Form1_FormClosing(sender As …System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing Try e.Cancel = True Me.WindowState = FormWindowState.Minimized Me.… Re: FormClosing event doesn't work as I want Programming Software Development by savedlema … to open form2. Problem: Since every form has a FormClosing event set, even when a user will open another form…Form2, the code me.close,Form2.Show will run causing FormClosing event of the previous form (form1)to run and …an example), all the other previous forms will have their FormClosing events fired, one after another which is a mess. I… FormClosing event doesn't work as I want Programming Software Development by savedlema …"Form Closing" event to write the code for FormClosing. Inside FormClose I call the "LogOff" sub explained…, whenever me.close is executed, all the code in the FormClosing event is also run, which means terminating the application. Whenever… Re: FormClosing event doesn't work as I want Programming Software Development by Minimalist … Form1_FormClosing(sender As Object, e As FormClosingEventArgs) _ Handles Me.FormClosing If e.CloseReason = CloseReason.UserClosing Then e.Cancel = True MsgBox… Re: FormClosing event doesn't work as I want Programming Software Development by gizidda Try disabling the formclosing event and modify the property of your aplication (not of the form) to 'when the last form closes'... http://i59.tinypic.com/295pj46.jpg Help with the FormClosing() Event Programming Software Development by TechSupportGeek … again guys, this time I need help with the [B]FormClosing()[/B] Event in the Picture Viewing application I made. I… Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If picShowPicture.Image IsNot Nothing Then If MessageBox.Show("… Application Exit does not trigger the FormClosing Programming Software Development by tanha Hi, When I click the X button of the window, the FormClosing is working as a charm, BUT when I kill the application, or restart the computer the application also closes but the FormClosing does not work. Why? and what should I do to execute a piece of code on this situation ? Re: Help with the FormClosing() Event Programming Software Development by sknake ….Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing If (saved = False) And (picShowPicture.Image IsNot Nothing) Then If… Re: Help with the FormClosing() Event Programming Software Development by TechSupportGeek … Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If picShowPicture.Image IsNot Nothing Then If MessageBox.Show("… Re: Help with the FormClosing() Event Programming Software Development by sknake … Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing If (saved = False) and (picShowPicture.Image IsNot Nothing) Then If… Re: Help with the FormClosing() Event Programming Software Development by babbu … Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing if DeterminingFactor = true then If picShowPicture.Image IsNot Nothing Then… Cancel FormClosing Programming Software Development by Gus_19 … System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Dim Result As DialogResult If saved = False Then Result = MessageBox… Re: Cancel FormClosing Programming Software Development by Reverend Jim … Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing 'If there are unsaved changes to the active library, ask… Re: FormClosing Event Question Programming Software Development by Reverend Jim How about a global boolean named MinimizeOnClose which is normally set to True. You could set it to False in ExitToolStripMenuItem_Click. Then in Form1_FormClosing you could test for that and determine whether or not to hide or close. Then your menu handler becomes Private Sub ExitToolStripMenuItem_Click(sender As System.Object, e As System.… Re: FormClosing Event Question Programming Software Development by Darkicon Thanks! I can't believe I didn't think about that before. Re: FormClosing event doesn't work as I want Programming Software Development by gizidda did you try to change the closing method in you appplication settings? you should use 'when last form closes' or something this way (sorry i don't know the english version, my Vstudio is in Italian) Re: FormClosing event doesn't work as I want Programming Software Development by savedlema Thank you gizida, but I have already done so. If I disable the form closing event, how then can I have it logg off a user when a user clicks the close X button without logging off from the database? That's what made me use the form closing event. Thanks. Re: FormClosing event doesn't work as I want Programming Software Development by gizidda what database? i cannot find anything about databases in the previous posts... I think it would be useful if you explain what kind of application it is... maybe you can zip the source and put it online? I would be glad to check it out and help you find a solution... i used a login system for my operating system emulation and i had no troubles with… Re: Help with the FormClosing() Event Programming Software Development by TechSupportGeek Thank you man, but I don't quite understand what to do. Can you be more specific? Sorry, I don't know very much about VB.NET. Re: Help with the FormClosing() Event Programming Software Development by TechSupportGeek Even though I used sknake's method, I want to thank you both guys for helping me out. Is there anything I can do for you? Re: Help with the FormClosing() Event Programming Software Development by sknake Just mark the thread as solved, which you already did :) Post back if you have any questions and good luck! Re: Application Exit does not trigger the FormClosing Programming Software Development by Diamonddrake when you use taskmanager to "kill" the appliction, it doesn't fire any events, It simply stops the execution, This is how you close an application that has frozen. if you waited for it to handle any events, then it would still be frozen. as for when you restart the computer or shutdown, the event will be called only if there is enough … Re: Application Exit does not trigger the FormClosing Programming Software Development by tanha Thanks much for the useful information Re: Cancel FormClosing Programming Software Development by Gus_19 It worked! Can't believe I forgot that part. Thanks Jim! Re: Cancel FormClosing Programming Software Development by Reverend Jim In case you missed it I revised the code a tad to give three options. It might have posted after you replied. Execute on 2ndFormClosing? Programming Software Development by TommyRay … System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing [/code] I know there are two similar events; FormClosing and FormClosed. I am unsure which… be more appropriate to use, but logically I am thinking FormClosing as the variable I wish to pass is still 'alive… Re: Execute on 2ndFormClosing? Programming Software Development by y2_sub … is why I am not seeing anything execute. If the FormClosing and FormClosed events are for the current form only, then… event handler [CODE]Dim optionsForm As New options AddHandler optionsForm.FormClosing, AddressOf Option_formClosing ' Add The Event Handler optionsForm.ShowDialog()[/CODE] [CODE… Re: Execute on 2ndFormClosing? Programming Software Development by TommyRay … is why I am not seeing anything execute. If the FormClosing and FormClosed events are for the current form only, then… Re: How to recover a form after hiding it! Programming Software Development by Lusiphur …showing the first form and closing the 2nd. Alternately, the FormClosing event SHOULD catch the close of the form and allow…msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing.aspx"]this page[/URL] has some resource information on… the use of the formclosing event that may or may not help. Re: Question about persistence of class variables Programming Software Development by Reverend Jim ….Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing lastx = Me.Left lasty = Me.Top End Sub Private Sub… Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing lastx = Me.Left lasty = Me.Top End Sub Private Sub…