Hi
I have seen already that example. In that example he is using "InstanceDescriptor" and creating altogether a new instance of that control. I cant do that. Is there any other work around?
Regards
Murali
Main Topics
Browse All TopicsHi,
I have a UserControl which is set as the SelectedObject of a PropertyGrid in windows forms.
In the add form user can edit the properties of the UserControl. I have a form in which the property grid of that UserControl is displayed. In runtime, I want to make the property grin readonly, but I could not make my propertyGid readonly, since my UserControl has both Read/Write properties. If I use .enabled=false, entire PropertyGrid becomes disabled so that user could not use scroll bars. I need to make the PropertyGrid ReadOnly in Form. How could this be done ?
Please help.
Murali
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
I have solved this by myself. There is noway that the property grid can be made readonly at runtime.
To resolve this, I did a work around.
When the property grid is loaded, then all proeprties with its values will be added to a Hashtable. This hashtable acts as a master. If any of the child properties are there for any property, then the "child property name.parent property name" as akey will be added to that hashtable without any value to it.
On the event of PropertyValueChanged, iterate through the Hashtable, get the value of the property from the hashtable ( with the property name as key ) and assign it back to the changed property. This way, even if the user changes the property it will be set back to its original value.
For child properties, while iterating though the hashtbale, check if the key starts with "child property name.". If so substring the key to get its parent property name and set the original value to that parent property.
I knew this is a round about way, but I could find only this as an appropriate solution.
Regards
Murali
Business Accounts
Answer for Membership
by: rama_krishna580Posted on 2004-06-02 at 23:22:08ID: 11219475
Hi,
com/csharp /DzDynamic Properties .asp
Look at this example , it exactly what you are looking for...
http://www.thecodeproject.
best of luck..
R.K