> Anybody can help me in C#.net how to do macro like vfp..
>
>
> Foxpro style:
>
> mystring = "thisform.textbox."
> myprop = "enabled"
> mytrue = "=.T."
>
> mymacro = mystring+myprop+mytrue
>
> &mymacro
>
>
> here's what I need in C#.net
>
> textBox1.Enable = true; - this would be my execution.
>
> string mystring mytexbox = "textBox1";
> string myprop = "Enable ==";
> boolean mytrue = true;
>
> How to execute it in C#?
>
>
> Thanks in advance...
>
> Gary
You cannot do that in c# but you can have a work-around. :-)
Execute(textBox1, "Enabled", false);
private void Execute(object aObj, string aProp, object aValue)
{
if (aObj != null)
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(aObj);
foreach(PropertyDescriptor prop in properties)
{
if (prop.Name == aProp)
{
prop.SetValue(aObj, aValue);
break;
}
}
}
}
Best Regards,
CriZ (,")
"Happiness is real when shared."