Hi, I have some forms in my project, and I want to make a method that closed one of them. Method:
public static void close_form (Form frm) { frm.Close(); }
And I use it like this:
public partial class myForm : Form { close_form(myForm); }
but when I want to run the application, I get the error: myFormis a "type", but is used as a "variable"
myForm
What am I doing wrong? Is there any other way to closeform without using this.close()?
close
this.close()
You pass the type of form, i.e. myFormyou need to pass an object of type you can passthis
this
public partial class myForm : Form { close_form(this); }
myForm - , Form . this , close_form, .
Form
close_form
, , , , , , , , .. this.Close close_form .
this.Close