By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,761 Members | 1,193 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,761 IT Pros & Developers. It's quick & easy.

Change Read/Write Property on Property Grid

P: n/a
Hi

Is there any way to enable/disable an item in a property grid at runtime?

I have two properties that I am showin in a property gris and based on the
validity of the first property, I want to disable/enable the second
property. Therefore the user would not be able to set or change the value
of the second property should a tes on the first property fail.

Regards, Carl Gilbert
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Carl,
Is there any way to enable/disable an item in a property grid at runtime?


From my understanding, I think you want to change the ReadOnly attribute of
the item in a PropertyGrid at runtime, is it?

If so, you are going to use custom PropertyDescriptor class for those
properties, and that class should implement the
"ICustomTypeDescriptor" interface for the usage of the properties of a
PropertyGrid, you can refer to the following group links for the detail
discussion and sample code:
http://groups-beta.google.com/group/...amework.window
sforms/browse_thread/thread/1f88a0b456c11af3/439a06cf4ca0aff2?q=propertygrid
+disable+item&_done=%2Fgroups%3Fq%3Dpropertygrid+d isable+item%26hl%3Den%26lr
%3D%26sa%3DN%26tab%3Dwg%26&_doneTitle=Back+to+Sear ch&&d#439a06cf4ca0aff2

By the way, another method is enumerating the item you want to disabled,
and clone a new property item(ReadOnly: ture) with it, then remove the old
one and add the new one at run time, you can find many samples how to add
(remove) Items of a PropertyGrid at runtime in the web...
Thanks!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default...sdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.