G
Guest
I have a snippet of code that feeds a tree view, the properties show up BUT
if I try and obtain the values of the property the code throws an error.
// throws an excpetion
//property_value = p.GetValue(this,null); //
// the VN .NET code for a similar project has
// property_value = .GetValue(Me, Nothing)
// i
Of course the object would not have values unless this object is
instantiated. So maybe that is a problem too. Please advise here's the
trouble:
objAssembly=System.Reflection.Assembly.LoadFrom(arAssemblyPath );
arOfTypes=objAssembly.GetTypes();
object property_value;
//Get Properties
try
{
PropertyInfo[] pInfo = t.GetProperties() ;
tn2=tn.Nodes.Add("Properties");
foreach(PropertyInfo p in pInfo)
{
if (p.GetIndexParameters().Length==0)
{
// throws an excpetion
// property_value = p.GetValue(this,null); //
// if (property_value ==null)
// {
// Console.WriteLine( "Object has no
value" );
// }
// else
// {
// Console.WriteLine( property_value.ToString() );
// }
}tn2.Nodes.Add(p.ToString());
}
}
if I try and obtain the values of the property the code throws an error.
// throws an excpetion
//property_value = p.GetValue(this,null); //
// the VN .NET code for a similar project has
// property_value = .GetValue(Me, Nothing)
// i
Of course the object would not have values unless this object is
instantiated. So maybe that is a problem too. Please advise here's the
trouble:
objAssembly=System.Reflection.Assembly.LoadFrom(arAssemblyPath );
arOfTypes=objAssembly.GetTypes();
object property_value;
//Get Properties
try
{
PropertyInfo[] pInfo = t.GetProperties() ;
tn2=tn.Nodes.Add("Properties");
foreach(PropertyInfo p in pInfo)
{
if (p.GetIndexParameters().Length==0)
{
// throws an excpetion
// property_value = p.GetValue(this,null); //
// if (property_value ==null)
// {
// Console.WriteLine( "Object has no
value" );
// }
// else
// {
// Console.WriteLine( property_value.ToString() );
// }
}tn2.Nodes.Add(p.ToString());
}
}