Notifications
Clear all

[Closed] DotNet Cancel Closing Event

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
 lo1

	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

Thanks guys! It works great and pretty simple! Thanks a lot!