473,395 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Change Read/Write Property on Property Grid

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
1 6928
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: windandwaves | last post by:
Hi Folk I am working with the TYPE property. I want to change that from 2 (byte) to 4 (long integer) for a field that already contains tons of data. How can I do that? The help reads: ...
1
by: travis powell | last post by:
i have created a string class. later on i created a procedure where i need to change charaters in the string. it seems to work just fine unitl i want to assigm the new character values to a...
12
by: Jens Thiel | last post by:
Hi, is there a reason for C# to require attribute arguments (properties) to be read-write while VB and C++ are happy with only a setter? Simplified Example: public sealed class FooAttribute...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
1
by: David Fúnez | last post by:
Hi; I'm working with Component One FlexGrid DataGrid, i've added a calculated field to the DataGrid, when i press the Save Button an error message is displayed "Cannot Change read Only...
1
by: darin_dimitrov | last post by:
Is it possible to determine if a property is read-only, write-only or read-write with reflection? Does MemberInfo class contains such information? Thanks
0
by: jwtulp | last post by:
Hello, I have a question about XmlSerialization. I have a class with a private field called createDate of the type DateTime. In the constructor of my class I use DateTime. Now to create a...
2
by: Saran | last post by:
Hi, Below is my scenario... I want to restrict my clients to access one of my class property in ReadOnly mode. At the same time as an author of the component i would like to have read-write...
3
by: Maurizio | last post by:
I create an application with Access 2000 and I wish to read/write the properties of a specified word document. I use dsofile.dll my code is Function fGetDocProps(strInFile As String, strProp As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.