Reflection: Getting fields in structure 
Author Message
 Reflection: Getting fields in structure

Hi all

Is it possible to get to the fields/values inside a structure using
reflection ??

I have tried this  :

private sub GetFields(obj as object)

  dim Fields as FieldInfo()
  dim ActField as FieldInfo

  Fields = obj.gettype.getfields()

  For each Field in Fields
    debug.writeline(Field.name)
  next

end sub

But this gets nothing

I have tried GetMembers, but all I get i four methods (GetHashCode, Equals,
ToString and GetType), the four Public methods of Object.

Is there some other way to do this ???

Thanks in advance

Allan Bredahl



Fri, 12 Aug 2005 23:25:34 GMT  
 Reflection: Getting fields in structure
Forget all about this post, it was me being stupid.

The fields in my structure were declared as Friend, not so clever.

Allan Bredahl



Fri, 12 Aug 2005 23:35:29 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Setting a value in a structure using Reflection

2. Getting the object name via reflection

3. Reflection issue: Getting instances of a Type?

4. VB2008: Getting the System.Reflection.PropertyInfo from within a class property

5. Getting image into field (SQL 7) and getting it back out

6. Getting Structure Information

7. Getting items from structure

8. Getting Access database structures with VB3

9. Getting at data in structure returned as a long pointer (Win API)

10. Getting a pointer to a user-defined structure

11. Getting filenames from directory structure

12. Getting directory structure

 

 
Powered by phpBB® Forum Software