Eliminate control property

I have created an extended version of DataGridView and now I want to set some of the inherited control's properties to fixed values and remove them from the properties editor. How?
LVL 1
tmostadAsked:
Who is Participating?
 
Bob LearnedCommented:
1) Override any overridable properties, shadow all others (if possible)

2) Add the <System.ComponentModel.Browsable(False)> attribute to the property.

Bob
0
 
tmostadAuthor Commented:
OK, good but how do I shadow a property that also happens to be a compiler keyword, specifically ReadOnly in this case. I want my grid to always be read only so I will shadow that property but obviously the compiler is complaining about my choice of property name.
0
 
tmostadAuthor Commented:
Oh yeah I should also add that the ReadOnly property for DataGridView is not overridable so I can't do that either.
0
 
Bob LearnedCommented:
You can use any keyword as variables, if you surround the name with brackets.

Public Property [ReadOnly] As Boolean
  Get
  End Get
  Set
  End Set
End Property

Bob
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.