PropertyGrid - Browsable property yet readonly?

T

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
 
T

Tom

Never mind, figured it out. Turns out you can't put the attribute
READONLY(TRUE) on the property, BUT you can put READONLYATTRIBUTE(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
 
C

Chris Dunaway

Never mind, figured it out. Turns out you can't put the attribute
READONLY(TRUE) on the property, BUT you can put READONLYATTRIBUTE(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_lunchmeat_[DOT]net

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

Tom

Chris: Crap, I should have thought of that myself ;-)

That explains it. Thanks.

Tom

Chris Dunaway said:
Never mind, figured it out. Turns out you can't put the attribute
READONLY(TRUE) on the property, BUT you can put READONLYATTRIBUTE(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_lunchmeat_[DOT]net

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top