I discover propertygrid which may be handy for editing or just showing some custom setup data in my program. But I have need for some attributes of properties to be changable.
Like 'readonly' attribute.
This is what I have so far:
Const myPersonCat As String = "MyPerson"
Const myDesc1 As String = "Firstname is one element"
<CategoryAttribute(myPersonCat), _
DescriptionAttribute(myDesc1), _
[ReadOnly](myBool)> _
Public Property firstname() As String
Get
Return _firstname
End Get
Set(ByVal value As String)
If Not _firstname = value Then save_param("firstname", value, myPersonCat, myDesc1)
_firstname = value
End Set
End Property
Const mydesc2 As String = "but Lastname is second"
<CategoryAttribute(myPersonCat), _
DescriptionAttribute(mydesc2), _
[ReadOnly](myBool)> _
Public Property lastname() As String
Get
Return _lastname
End Get
Set(ByVal value As String)
If Not _lastname = value Then save_param("lastname", value, myPersonCat, myDesc2)
_lastname = value
End Set
End Property
Save_param is call to function which saves property with basic data in database.
All of that work's nice.
But now is a question...
Is here some, not too complicated way to setting 'myBool' for readonly attribute with variable instead of constant with which I can block to change some properties dependable of situation in program.
Maybe for whole category or for a single property?
Or maybe here exists some other way to get similar functionality?