How get the control name in C#?

sitajony

Active Member
Licensed User
Hello, today I'm searching for get the control name, apparently it return the control class but not his name...
How get the "propname" propriety directly in C#?

Thanks for your replies!
 

agraham

Expert
Licensed User
Longtime User
It's not clear exactly what you want to do and under what circumstances. However assuming that you want to access the propName property for an arbitrary control in a library at runtime then you can get it by reflection.
B4X:
public string GetPropName(Control ctl)
{
  PropertyInfo pinfo = ctl.GetType().GetProperty("propName");
  return (string) pinfo.GetValue(ctl, null);
}
This will work both in the IDE and when compiled but remember that only intrinsic Basic4ppc controls have that property.
 

sitajony

Active Member
Licensed User
Thanks, I've forgot this possibility...
Yes, it's just for get a Basic4PPC control name from a library...
Now it works, thanks again!
 
Top