|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reflection problemHi,
i'm trying to access a property value in this way: PropertyInfo pi = myObject.GetType().GetProperty(myPropName); I'm sure that the object myObject have the myPropName property, but the pi variable result nothing. Can you help me?? Hi,
If you know the type of the object or the super class/interface of a collection of objects I would do the following: If typeof myobject is objectType then propertyinfo pi = ctype(myObject,objectType).myPropName end if I hope that helps. "scoffer" <scof***@email.it> schrieb: Check out the overloaded verisons of 'GetProperty', especially those which > i'm trying to access a property value in this way: > > PropertyInfo pi = myObject.GetType().GetProperty(myPropName); > > I'm sure that the object myObject have the myPropName property, but the pi > variable result nothing. accept 'BindingFlags'. Specify 'BindingFlags.Instance' and appropriate binding flags for the accessibility of the property. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Frustrated trying to use "pure" VS.NET to access database properties
VB.NET Windows Service Question (Timing) How Do I Put An End Of Line Character In A TextBox Export to excel without using office automation Detect if Themes are enabled? Dynamically Create Timers are Run-Time VB Express - How to access query value on my form? VS2003 and VS2005 Side by Side Databinding 2 comboboxes to the same Datasource Wall chart of VB.net class structure? |
|||||||||||||||||||||||