I have a class names Customer with several properties. I have the property I wish to set in one string and the value to set it to in another.
Dim cust As New Customer
Dim strProp As String = "name"
Dim strVal As String = "Chris"
Is there a simple way of setting the property in strProp the the value in strVal?
I've written a function to do it using TypeDescriptor.GetProperties(obj) to get the properties, then finding the one I want and setting it that way but I can't believe this is the quickest way.