有一种在运行时在表单中添加自定义属性(即TextBox1)的简单方法吗?我的意思是避免创建和使用自定义控件,只需向标准属性添加自定义属性。
...以便可以像
那样设置和访问它Me.TextBox1.MyCustomProperty = "my string or value"
让我们以类似于使用结构的方式说:
Public Structure uAccess
Dim isEditable As Boolean
Dim isKoopPrice As Boolean
Dim isUserEditable As Boolean
Dim isManagerEditable As Boolean
End Structure
Dim Col1Access As uAccess
With Col1Access
.isEditable = False
.isManagerEditable = False
.isSalePrice = False
.isUserEditable = False
End With
致以最诚挚的问候,
Libor的
答案 0 :(得分:2)
将其添加到.Tag
的{{1}}属性,因为它是Textbox
,您可以在其中存储任何内容。
Object
取回物品:
Dim col1Access As New uAccess
With Col1Access
.isEditable = False
.isManagerEditable = False
.isSalePrice = False
.isUserEditable = False
End With
Textbox1.Tag = col1Access ' know as boxing