[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

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?
0
tmostad
Asked:
tmostad
  • 2
  • 2
1 Solution
 
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now