In my application I am opening & closing form multiple time. This form contains picture Box & Image list. While reopening Form i am getting error
An unexpected error has occurred in .exe file
After clicking details it gives
Exception error in System.Windows.Forms.Imagelist.setImageSize()
While closing form using cancel button on form I had written code.
private void btnCancel_click(Object Sender, Eventargs e)
{
if(pictureBox1.Image != null)
{
pictureBox1.Image.Dispose();
pictureBox1.Image = null;
}
this.Dialogresult = DialogResult.Cancel();
this.Dispose();
}