내 프로그램에서 편집 또는 일부 사용자 정의 설치 데이터를 보여주는 데 유용 할 수있는 propertygrid를 발견했습니다. 그러나 속성의 속성을 변경해야 할 필요가 있습니다.
'읽기 전용'속성과 같습니다.vb.net에서 런타임에 속성 속성을 변경합니다
이것은 내가 지금까지 무엇을 가지고 :
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 데이터베이스의 기본 데이터와 속성을 저장하는 기능을하는 호출입니다.
그 모든 것이 훌륭합니다.
하지만 지금은 질문입니다 ... 일부 상황은 프로그램의 상황에 따라 신뢰할 수있는 일부 속성을 변경하기 위해 차단할 수있는 상수 대신 변수로 읽기 전용 속성에 'myBool'을 설정하는 데 너무 복잡하지 않습니다.
전체 카테고리 또는 단일 속성 일 수도 있습니까?
아니면 비슷한 기능을 사용하는 다른 방법이 있습니까?
** 확인 ** http://stackoverflow.com/questions/51269/change-attributes-parameter-at-runtime –