Torna al Thread
Public Function SetProperty(ByVal obj As Object, ByVal propertyName As String, ByVal val As Object) As Boolean
Try
Dim properties() As String = propertyName.Split("|")
Dim pi As System.Reflection.PropertyInfo = Nothing
For Each p As String In properties
pi = obj.GetType().GetProperty(p)
If Not pi Is Nothing Then Exit For
Next
If pi Is Nothing Then Return False
val = Convert.ChangeType(val, pi.PropertyType)
pi.SetValue(obj, val, Nothing)
Return True
Catch
Return False
End Try
End Function