473,626 Members | 3,041 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PropertyGrid - Browsable property yet readonly?

Tom
I'm using the PropertyGrid, and have it bound to a class object. Works
fine - however, I have some properties that I want to show up on the grid
(i.e. they are browsable) -YET- I don't want the user to be able to change
them; i.e. want them ReadOnly to the grid. I tried setting that classes
property to the ReadOnly attrib, but it wouldn't take it. (Keywork is not
valid as an identifier)

So how can one have a property value that shows up on the property grid YET
is ReadOnly? I'm sure it has got to be some attribute but can't figure out
what it is.

Thanks.

Tom
Nov 21 '05 #1
3 4742
Tom
Never mind, figured it out. Turns out you can't put the attribute
READONLY(TRUE) on the property, BUT you can put READONLYATTRIBU TE(TRUE) on
the property and it works!?! I am not sure what the difference is between
the two... but the second one does work.

Tom
"Tom" <to*@nospam.com > wrote in message
news:u3******** ******@TK2MSFTN GP14.phx.gbl...
I'm using the PropertyGrid, and have it bound to a class object. Works
fine - however, I have some properties that I want to show up on the grid
(i.e. they are browsable) -YET- I don't want the user to be able to change
them; i.e. want them ReadOnly to the grid. I tried setting that classes
property to the ReadOnly attrib, but it wouldn't take it. (Keywork is not
valid as an identifier)

So how can one have a property value that shows up on the property grid YET is ReadOnly? I'm sure it has got to be some attribute but can't figure out
what it is.

Thanks.

Tom

Nov 21 '05 #2
On Thu, 7 Oct 2004 08:06:18 -0400, Tom wrote:
Never mind, figured it out. Turns out you can't put the attribute
READONLY(TRUE) on the property, BUT you can put READONLYATTRIBU TE(TRUE) on
the property and it works!?! I am not sure what the difference is between
the two... but the second one does work.


Since ReadOnly is a VB keyword, you would have to place it in square
brackets:

<[Readonly](True)>
--
Chris

dunawayc[AT]sbcglobal_lunch meat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Nov 21 '05 #3
Tom
Chris: Crap, I should have thought of that myself ;-)

That explains it. Thanks.

Tom

"Chris Dunaway" <"dunawayc[[at]_lunchmeat_sbcg lobal[dot]]net"> wrote in
message news:1a******** *************** ******@40tude.n et...
On Thu, 7 Oct 2004 08:06:18 -0400, Tom wrote:
Never mind, figured it out. Turns out you can't put the attribute
READONLY(TRUE) on the property, BUT you can put READONLYATTRIBU TE(TRUE) on the property and it works!?! I am not sure what the difference is between the two... but the second one does work.


Since ReadOnly is a VB keyword, you would have to place it in square
brackets:

<[Readonly](True)>
--
Chris

dunawayc[AT]sbcglobal_lunch meat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1415
by: micro_bug | last post by:
Now I am developing a tool, just like VS.net Form Edition environment. User can edit a component's properties by a PropertyGrid control. Now I have some questions about this PropertyGrid control: 1. How to verify a property's validifity? as you know, In VS.net, when we input a component name that is same with an existed name in the propertygrid, an error message will pop up: "Invalid property value". Now, my question is, how to implement...
1
1986
by: S.mark | last post by:
Hi, I can't find the ReadOnly property in PropertyGrid control (Visual Studio 2005), is there any work around to display object properties with the new PropertyGrid control in ReadOnly mode ? Thank you.
1
11870
by: ANDRES BECERRA | last post by:
Herfried K. Wagner was kind enough to point me to the PropertyGrid control http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformspropertygridclasstopic.asp I have found a few samples of how to use the PropertyGrid control and have gained a decent understanding of it. But of course, as it usually the case, my needs go far beyond the simple examples shown in online samples. All the online samples show how to take a class...
2
4832
by: Lance | last post by:
I want to be able to reset a complex property in a PropertyGrid. I know that for properties that are ValueTypes you can include System.ComponentModel.DefaultValue in the declaration of the property. But, for complex property types (e.g., instance types) this does not work because System.ComponentModel.DefaultValue requires a constant value In order to indicate if a property should be serialized you can include a boolean function named...
2
2132
by: =?Utf-8?B?TWF1cmljZU0=?= | last post by:
Hi all, how can I hide a property in a derived class in a propertygrid. Let's say I have a classX and a derived classY. A property in classX will be visible in the propertygrid but the same property in the derived classY will not be visible in the propertygrid. Does anyone know how to do this ?
2
1928
by: =?Utf-8?B?Sm9obiBPbGJlcnQ=?= | last post by:
Is there a way to pass a class to the SelectedObject of PropertyGrid and have it only show the properties in the child class and not those in the base class's that it is derived from? Thanks. -- John Olbert
4
5093
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I have assigned an existing object to propertygrid.selectedobject property. But I only want some of the object's properties not browsable and/or readonly. How can I do that? I'm trying to find information about propertygrid but most of the information seems to be for VS2003.
3
5121
by: michelqa | last post by:
Hi, I have a form with a control..(a button for example). Then the control properties are displayed in a propertyGrid control. Is there any simple way to remove some unwanted properties from the propertyGrid....removing the "AccessibleName" properties by example? Any example about how to play with the PropertyDescriptorCollection to remove some properties??
0
1216
by: ntabb | last post by:
Hello all, I have a class instance that I'm attaching to a propertygrid. I would like to find a way to change the "Browsable" attribute during runtime or programmatically from outside the class definition. I would like the end result to display certain contents of the class based on the "machinetype" variable's value. Any suggestions? public class Equipment {
0
8192
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8502
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7188
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4195
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.