The 'X' click event
-
Does anybody know how to get the ‘X’ click event?….the ‘X’ in the upper right hand corner of a form. I want to perform a function if the ‘X’ is used to close the form (something like frmMain_ClickX) but if I use frmMain_Closing it causes certain functions to execute twice. I’m assuming that frmMain_Click is not specifically associated with the click event of the ‘X’. Thanks Brad
-
Does anybody know how to get the ‘X’ click event?….the ‘X’ in the upper right hand corner of a form. I want to perform a function if the ‘X’ is used to close the form (something like frmMain_ClickX) but if I use frmMain_Closing it causes certain functions to execute twice. I’m assuming that frmMain_Click is not specifically associated with the click event of the ‘X’. Thanks Brad
-
Private Sub _whatever_you_want_(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
I’m still a bit confused. I have the following sub that I want to be sure is executed whenever the form closes: SaveData() I have programmed the sub ‘SaveData()’ to execute under the ‘mnuExit_Click’ (and other areas). My problem is that ‘SaveData()’ is executed once when ‘mnuExit_Click’ is executed and then again during frm1_cloising. I assume that it is bad practice to just execute ‘SaveData()’ in ‘frm1_closing’ and in no other location. Thanks Brad
-
I’m still a bit confused. I have the following sub that I want to be sure is executed whenever the form closes: SaveData() I have programmed the sub ‘SaveData()’ to execute under the ‘mnuExit_Click’ (and other areas). My problem is that ‘SaveData()’ is executed once when ‘mnuExit_Click’ is executed and then again during frm1_cloising. I assume that it is bad practice to just execute ‘SaveData()’ in ‘frm1_closing’ and in no other location. Thanks Brad
Brad Fackrell wrote: I assume that it is bad practice to just execute ‘SaveData()’ in ‘frm1_closing’ and in no other location. The reason why it's getting executed twice is because you execute it in the mnuExit handler AND your doing it again when the Closing event is fired. If you want to handle all possible ways of closing a form, then the Closing event is the way to go... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Brad Fackrell wrote: I assume that it is bad practice to just execute ‘SaveData()’ in ‘frm1_closing’ and in no other location. The reason why it's getting executed twice is because you execute it in the mnuExit handler AND your doing it again when the Closing event is fired. If you want to handle all possible ways of closing a form, then the Closing event is the way to go... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave Kreskowiak wrote: If you want to handle all possible ways of closing a form, then the Closing event is the way to go... Okay. I thought that would work but then I "second guessed" myself because I thought; Why add any sub routines under mneExit? Thanks Dave.
-
I’m still a bit confused. I have the following sub that I want to be sure is executed whenever the form closes: SaveData() I have programmed the sub ‘SaveData()’ to execute under the ‘mnuExit_Click’ (and other areas). My problem is that ‘SaveData()’ is executed once when ‘mnuExit_Click’ is executed and then again during frm1_cloising. I assume that it is bad practice to just execute ‘SaveData()’ in ‘frm1_closing’ and in no other location. Thanks Brad
-
Replace SaveData() in mnuExit_Click and all other locations (except frm1_closing) by Me.Close().
Works perfect! Thank you ;) Brad