Thursday, March 16, 2006

.NET 247 : CallByName in C#? on microsoft.public.dotnet.languages.csharp:

This is what I needed:

public static void SetControlProperty(Control control, string propertyName,
object propertyValue)
{
Type myType = control.GetType();
PropertyInfo myInfo = myType.GetProperty(propertyName);
myInfo.SetValue(control, propertyValue, null);
}

0 Comments:

Post a Comment

<< Home