By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

unload

P: n/a
hi all,

if i close my form, withe the close button in the frame, i want a messagebox
displaying "are you shure"

how do i do this, i see that the unload statement is gone

kind regards,
Maarten
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Maarten" <gu******@hotmail.com> schrieb:
if i close my form, withe the close button in the frame, i want a
messagebox displaying "are you shure"


\\\
Private Sub Form1_Closing( _
ByVal sender As Object, _
ByVal e As CancelEventArgs _
) Handles MyBase.Closing
If _
MsgBox( _
"Really close?", _
MsgBoxStyle.YesNo Or MsgBoxStyle.Question _
) = MsgBoxResult.No _
Then
e.Cancel = True
End If
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2

P: n/a
thanks for the code,but

I get an error (underlined) in the CancelEventArgs

regards,
Maarten

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Maarten" <gu******@hotmail.com> schrieb:
if i close my form, withe the close button in the frame, i want a
messagebox displaying "are you shure"


\\\
Private Sub Form1_Closing( _
ByVal sender As Object, _
ByVal e As CancelEventArgs _
) Handles MyBase.Closing
If _
MsgBox( _
"Really close?", _
MsgBoxStyle.YesNo Or MsgBoxStyle.Question _
) = MsgBoxResult.No _
Then
e.Cancel = True
End If
End Sub
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

P: n/a
"Maarten" <gu******@hotmail.com> schrieb:
I get an error (underlined) in the CancelEventArgs


Add 'Imports System.ComponentModel' to the imports section of your VB file.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #4

P: n/a
thank you,

More simple than i tought.

regards,
Maarten

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
"Maarten" <gu******@hotmail.com> schrieb:
I get an error (underlined) in the CancelEventArgs


Add 'Imports System.ComponentModel' to the imports section of your VB
file.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.