反射应用之一:根据控件名、属性名进行取值和
- 作者:xiaoxiao
- 发表时间:2020-12-23 10:53
- 来源:未知
'必须引用命名空间System.Reflection,System.ComponentModel
'以下根据控件名和属性名取值
Public Function GetValueControlProperty(ByVal ClassInstance As Object, ByVal ControlName As String, ByVal PropertyName As String) As Object
Dim Result As Object
Dim myType As Type = ClassInstance.GetType
Dim myFieldInfo As FieldInfo = myType.GetField("_" & ControlName, BindingFlags.NonPublic Or _