***i'm writing my code in VB.NET
Im using a Property Grid control in my form.
I need to display different properties in the grid according to the Situation. So I predefined classes of the required categories, and required properties.
In run time, depending on the user inputs I Build the property grid according to one of my predefined classes, and in the NEW function I plant the required default values to each property (according to some configuration files). then the user can change those default values.
I need to make some fields read only during run time according to the values they have, so the user wont be able to change them.
The user presses a button and I ENABLE the property grid control
1. I build the property grid with the required properties (Name, Age, Degree)
2. In the new event I read some configuration files and initialize the values of each property
PropertyGrid1.SelectedObject = New MyProperties(MyName, MyAge, MyDegree)
Now this is how my property grid looks like:
You can see that I dont have a degree, thus the value of the Degree property is NA
In this point I want BY CODE to make the property Degree read only, so the user couldnt edit it.
I cant find a way to loop all the properties, and if a properties value = NA than to make it read only