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
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5