I created WinForm application with C# 2008 NET framework 2.0. I need example how to call method with Reflection. Look follow code.
We have form, which have public object mdtForm . DataSpread is other class which has metods.
public partial class frmCampaign : Form
public DataSpread mdtForm;
// .. and so on..
This form is MDI child. I want to use Reflection to call something like:
frmCampaign.mdtForm.ViewChange() but with reflecation. I need to use Reflection, becaouse I need to call metod of activeform which may be different from frmCampaign.
Here is example which works OK how to execute procedure of form. But I need example how to execute frmCampaign.mdtForm.ChangeView.
private void buttonGrdView_Click(object sender, EventArgs e)
Form activeForm = this.ActiveMdiChild;
Type m = activeForm.GetType();
MethodInfo a = m.GetMethod("changeview");
a1 = new object;
a1 = true;
a.Invoke(activeForm,a1); //= frmCampaign.ViewChange(true) and work OK
// But I want to call frmCampaign.mdtForm.ViewChange(true).