View Full Version : Print all property values of a class

Jan 12th, 2006, 08:59 PM
I have a collection of objects. I can successfully loop through the collection, and print the value of any property by explicitly stating the property such as obj.ProductGID will print out the value of the current object's ProductGID property.

Looking for a way to print out the values without having to explicitly stating each one. The code below will print the names of the properties, but I don't know how to get the value.

Can anyone help?

Dim prop As System.Reflection.PropertyInfo
For Each prop In obj.GetType.GetProperties()
Debug.Write(prop.Name & " ^^ ")
Next prop

Jan 13th, 2006, 06:40 PM
This might help.