i use "this.hide();" to hide a form...and when i use this form in another form by
form sf=new form();
sf.visible=true;
the form is again show...but when i close the main form and run the programme again it show me two errros
because this programme is processing in the taskbar...
when i manually end the process and run the programme again it show me no errros ..suicessfully run the programme..
plz anybody help me..
VulpesPosted Jun 4, 2014, 7:06 PM
What it will do instead is to create a new form instance and make that visible. The previous instance will still be hidden.
Here's one way of making the current instance visible again:
// use actual form name here unless it really is 'form'
form sf = Application.OpenForms["form"] as form;
if (sf != null) sf.Visible = true;
One other point I'll mention in case it's relevant is that if you've created any other foreground thread apart from the main UI thread, then closing the main form will not necessarily end the application. The other forground thread will continue to run until (if ever) it terminates naturally.
To avoid this problem, when creating the thread just set its IsBackground property to true (the default is false) before you start it. Closing the main form should then terminate the background thread prior to closing the application.