Were experimenting with getting access to the members of a program and using the methods and properties in them. Would use it to later use the functions/properties by reading a file and use them at runtime. But got a problem. Can make it work if it only has to do with the form, by using 'this' as the parameter(See mark*) but don´t know how to access others members except writing it directly in code, but that´s not what I want to.
Code:
Assembly addon = null;
addon = Assembly.GetExecutingAssembly();
Type[] tp = addon.GetTypes();
FieldInfo tl = tp[1].GetField("toolStripButton1");
Type tg = tl.FieldType;
PropertyInfo pI = tg.GetProperty("Text");
object[] param = new object[1];
param[0] = "Test";
This line * pI.SetValue(this.toolStripButton1, param[0], null);
Hope you can help. Hope the code isn´t to hard to understand. When writing some 'idea' code I usually use fast var names.