Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


C# - Close form during Load Event
Closing a C# Windows Form during the Load Event is not allowed, and neither is closing it during CreateHandle or OnHandleCreated.
To close the form, call Close during the VisibleChanged Event, when Visible=true (called when showing the form).

Created By: amos 3/20/2006 12:12:59 AM

 > Guest 7/7/2010 12:23:46 AM
You may use the following code to close a form in form_load event..
this.BeginInvoke(new MethodInvoker(this.Close));