Imports System.Reflection
Public Class Form1
Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim o As Object = Activator.CreateInstance(Type.GetType( " A.a ")) ' 工程名称.类名
Dim MyProperty As PropertyInfo = o.GetType().GetProperty( " NAME ")
Dim objValue As Object = " Bbb "
MyProperty.SetValue(o, objValue, Nothing)
Dim objReturn() As Object
MsgBox(MyProperty.GetValue(o, objReturn).ToString())
End Sub
End Class
Public Class a
private _name As String
Public _id As Integer
Public Property NAME() As String
Get
Return _name
End Get
Set( ByVal value As String)
_name = value
End Set
End Property
End Class
Public Class Form1
Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim o As Object = Activator.CreateInstance(Type.GetType( " A.a ")) ' 工程名称.类名
Dim MyProperty As PropertyInfo = o.GetType().GetProperty( " NAME ")
Dim objValue As Object = " Bbb "
MyProperty.SetValue(o, objValue, Nothing)
Dim objReturn() As Object
MsgBox(MyProperty.GetValue(o, objReturn).ToString())
End Sub
End Class
Public Class a
private _name As String
Public _id As Integer
Public Property NAME() As String
Get
Return _name
End Get
Set( ByVal value As String)
_name = value
End Set
End Property
End Class