Notifications
Clear all
[Closed] DotNet Cancel Closing Event
May 04, 2011 6:01 pm
Hey guys! Is there a way to cancel a closing event of a form… i was thinking of an eventhandler with a function to cancel… but I really don’t know how! I just want that is a form is closed it cancels and hide it so it ain’t disposed. Thanks for your help! Found this on msdn but don’t know how to make it happen! http://msdn.microsoft.com/en-us/library/system.componentmodel.canceleventargs.aspx
3 Replies
May 04, 2011 6:01 pm
use this event and set cancel property to true
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing.aspx
May 04, 2011 6:01 pm
fn onClosing s e =
(
format "%
" (e.CloseReason.ToString())
if e.CloseReason == e.CloseReason.UserClosing do
(
e.Cancel = on
s.Hide()
)
)
dotnet.addeventhandler form "Closing" onClosing
to close the form use Dispose() method