Is there a form close or try to close event?
what can I use to "show do you want to save the file" msgbox
is there a on form close event or something, I couldnt find anything
If the form's close buttone is closed it should ask if we want to save the file or not, if the user want to save the file the save function should be called
Re: Is there a form close or try to close event?
Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
MsgBox ("Do you want to save the file?", Msgboxstyle.YesNo + MessageBoxIcon.Question)
End Sub
Re: Is there a form close or try to close event?
Probably want to start using MessageBox.Show
vb Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) _
Handles Me.FormClosing
Select Case MessageBox.Show("Would you like to save the form before closing?", "Close?", MessageBoxButtons.YesNo)
Case Windows.Forms.DialogResult.Yes
'e.Cancel = True 'Not really needed but you may want it
'Save info here
Case Windows.Forms.DialogResult.No
e.Cancel = False
End Select
End Sub
Re: Is there a form close or try to close event?
and you can put a "SaveFileDialog1" Control so you can able to save your Windows Application .... ^^
Re: Is there a form close or try to close event?
thanks a lot guys that worked perfectly
guys and girls sorry!
Re: Is there a form close or try to close event?