|
-
Apr 22nd, 2007, 08:44 AM
#1
Thread Starter
Banned
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
-
Apr 22nd, 2007, 09:02 AM
#2
Fanatic Member
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
-
Apr 22nd, 2007, 09:08 AM
#3
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
-
Apr 22nd, 2007, 09:18 AM
#4
Fanatic Member
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 .... ^^
-
Apr 22nd, 2007, 10:26 AM
#5
Thread Starter
Banned
Re: Is there a form close or try to close event?
thanks a lot guys that worked perfectly
guys and girls sorry!
-
Apr 22nd, 2007, 10:30 AM
#6
Thread Starter
Banned
Re: Is there a form close or try to close event?
Last edited by ethicalhacker; Apr 22nd, 2007 at 10:36 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|