c# - form closing An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.Windows.Forms.dll -


hi have form , want open form when user close current form can see here :

private void frmdashboard_formclosing(object sender, formclosingeventargs e)         {             this.close();             frmconcerns = new frmconcerns();             a.showdialog();         } 

but when click on close button error :

an unhandled exception of type 'system.componentmodel.win32exception' occurred in system.windows.forms.dll  additional information: error creating window handle. 

this.close() closes current form - being done right because otherwise formclosing event wouldn't have been invoked. remove line.

also, if want show dialog modal window, should provide parent form, instead of calling a.showdialog(); rather call a.showdialog(this);.

if error still there can assure code you've shown correct after modifications i've suggested - i've done similar things before. in case error must occur in other parts of code you've not shown us.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -