Torna al Thread
Public Function GetObjectProperty(ByVal obj As Object, ByVal propertyName As String) As Object
If _syncInvokeObject.InvokeRequired Then
_syncInvokeObject.Invoke(New getCtrlPropertyDelegate(AddressOf GetObjectProperty), New Object() {obj, propertyName})
Else
Dim propInfoArray() As System.Reflection.PropertyInfo
Dim result As New System.Text.StringBuilder
'get array of propertyinfo objects for our targets Type
propInfoArray = obj.GetType.GetProperties
'iterate through these propertyinfo objects
For Each propInfo As System.Reflection.PropertyInfo In propInfoArray
Dim s As Object
Try
's = Convert.ToString(propInfo.GetValue(obj, Nothing))
s = propInfo.GetValue(obj, Nothing).ToString()
Catch ex As Exception
s = ""
End Try
If propInfo.Name = propertyName Then
Return s
End If
Next
End If
Return ""
End Function