1

I am aware this property is read only. But I really need to set the value. Is there a way to change the value of GridItem (System.Windows.Forms.GridItem) by using Reflection? If so, how?

Thank you.

Dave New
  • 38,496
  • 59
  • 215
  • 394
Alex
  • 937
  • 3
  • 20
  • 44

1 Answers1

0

Yes, you can do this using reflection. Here is a previous post with the answer.

But you most definitely do not want to change it. It has been designed in such a way for a very important reason. You will degrade the integrity of the object instance.

Community
  • 1
  • 1
Dave New
  • 38,496
  • 59
  • 215
  • 394
  • Type valueProperty = typeof(GridItem); FieldInfo valueField = valueProperty.GetField("value", BindingFlags.NonPublic | BindingFlags.Instance); I tried both "Value" and "value", but this always returns null. This is the reason I am asking the question here. – Alex Nov 28 '12 at 11:21