Calling a windows form
-
Hi every one i have a form name sotred in string parameter i want to create object from that form and show this form thx hosam taji
-
Hi every one i have a form name sotred in string parameter i want to create object from that form and show this form thx hosam taji
public Form CreateFormThroughName(string formClassName) { switch(formClassName) { case "FormA": return new FormA(); case "FormB": return new FormB(); } } try it!!!!!
-
Hi every one i have a form name sotred in string parameter i want to create object from that form and show this form thx hosam taji
simply ask thanks if it works
-
public Form CreateFormThroughName(string formClassName) { switch(formClassName) { case "FormA": return new FormA(); case "FormB": return new FormB(); } } try it!!!!!
First Thx You For Your Help But This is not exactly what i want Realy i want something like this not return new formClassName thx A gain
-
Hi every one i have a form name sotred in string parameter i want to create object from that form and show this form thx hosam taji
You could use reflection, or if the collection of names is known, use the approach that was given by someone else. Personally, if I had a known collection, I'd be storing an enum, not strings.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
First Thx You For Your Help But This is not exactly what i want Realy i want something like this not return new formClassName thx A gain
Perhaps you need to explain it better?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Perhaps you need to explain it better?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
do you know the names of all form in advance?
-
Perhaps you need to explain it better?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Yes Thats Exactly What I Want How To Use The Refliction in this case Hosam Taji
-
You could use reflection, or if the collection of names is known, use the approach that was given by someone else. Personally, if I had a known collection, I'd be storing an enum, not strings.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
This The Code Form frm = new Form(); Assembly LocalApp; string man = treeView1.SelectedNode.Name; MessageBox.Show(man); LocalApp = Assembly.LoadFrom(man); ???
-
This The Code Form frm = new Form(); Assembly LocalApp; string man = treeView1.SelectedNode.Name; MessageBox.Show(man); LocalApp = Assembly.LoadFrom(man); ???
hosam Taji wrote:
Assembly LocalApp; string man = treeView1.SelectedNode.Name; MessageBox.Show(man); LocalApp = Assembly.LoadFrom(man);
I don't know what any of this means ? I mean, what's in the treeview ? Form names, found via reflection ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Hi every one i have a form name sotred in string parameter i want to create object from that form and show this form thx hosam taji
This is off the top of my head and doesn't include any error checking.
Assembly asm = System.Reflection.Assembly.LoadFrom ("myAssembly.dll");
Type t = asm.GetType ("MyNamespace.MyForm");
ConstructorInfo constructor = t.GetConstructor (new Type[] {});
MyNamespace.MyForm form = constructor.Invoke (null) as MyNamespace.MyForm;/ravi
This is your brain on Celcius Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com