What shuld I do on my code to make it work on both vb and csharp(ok). This
code are in a dll
It seems that withevents cause a problem on fieldinfo
private Control getObject(string ControlName)
{
//return an handle of the control
try
{
if(ControlName != FormOwner.Name)
{
BindingFlags bf = BindingFlags.IgnoreCase | BindingFlags.Instance |
BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static |
BindingFlags.GetField;
Type t = FormOwner.GetType();
----- PROBLEM HERE ------
System.Reflection.FieldInfo fi = t.GetField(ControlName,bf)
;------------------------------------
object o = fi.GetValue(FormOwner);
return (Control)o;
}
else
{
return FormOwner;
}
}
catch
{
return null;
}
}
Thank for the help