jeudi 19 février 2015

I have the following working code, this open an form from a loaded .dll using assembly



Form main = (Form)CommandFacade.IModuleHandler.IHost as Form;
Assembly Assembly = (Assembly)IArticles.Assembly;
Type Type = Assembly.GetType("DAMS.Module.ARTICLES.Articles_Search", true);
Form Articles_Search = (Form)Activator.CreateInstance(Type) as Form;
Articles_Search.MdiParent = main;
Articles_Search.StartPosition = FormStartPosition.CenterScreen;
Articles_Search.Show();


But i have declared 2 Dictionary (FormBehavior, HiddenColumns) in this Form, i need to set values or add a new item to this dictionary using reflection. Normally i use this code but how i can do it using reflection?



Articles_Search.FormBehavior["Control"] = "Value";
Articles_Search.HiddenColumns.Add("article_cost");


This is the Article_Search Class:



public partial class Articles_Search : Form
{
// Actions Vars
public List<String> HiddenColumns = new List<String>();
public Dictionary<String, Object> FormBehavior = new Dictionary<String, Object> { (String)"Control", null } };
}





Aucun commentaire:

Enregistrer un commentaire