jeudi 19 février 2015

C# Create a new Form from Assembly Reflection

I have some problems displaying a form, This is my code:



Assembly assembly = (Assembly)IArticles.Assembly;
Type type = assembly.GetType("DAMS.Module.ARTICLES.Articles_New", true);
Form form = (Form)Activator.CreateInstance(type) as Form;
form.ShowDialog();

//Console.WriteLine(form); //Return: DAMS.Module.ARTICLES.Articles_New, Text: Articles_New


I'm trying to open a new form getting the object instance using Reflection and Assemblies.


The form name is: Articles_New and their NameSpace is DAMS.Module.ARTICLES






Aucun commentaire:

Enregistrer un commentaire