Answers for "Set property of control on form by name"

C#
0

Set property of control on form by name

var controlName = 'yourcontrolName from db';
var propertyName = 'your property name from db';
object value = //the deserialized value from db;

var control = findControlByName(controlName);
control.GetType().GetProperty(propertyName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance).SetValue(control, value, new object[] { });
Posted by: Guest on July-15-2021

C# Answers by Framework

Browse Popular Code Answers by Language