PropertyGrid - Browsable property yet readonly?

  • Thread starter Thread starter Tom
  • Start date Start date
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
 
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
 
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.
 
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.
 
Back
Top