I found same problem when i use form X button on forms right hand corner. "An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll

Additional information: Value Dispose() cannot be called while doing CreateHandle()."I try this solution and it worksI found form property Cancel Button which assign as 'None'I add new exit button and do exitbutton click event In that i call function as 'Close();'this exitbuttotn i link to 'form property Cancel Button' It works well when i click on form X button.I change that and assign new procesdure which has