473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Reflection - GetValue in a Structure

Hello,

i have this structure..

Public Structure MyStructure
a as boolean
b as boolean
c as boolean
....
end structure

Dim Infos() As FieldInfo
Dim fi As FieldInfo
mInfos = GetType(MyStructure).GetFields

for each fi in Infos
msgbox fi.name
next

I Would "VALUE" for this Field..
Jul 24 '06 #1
1 2583

John wrote:
Hello,

i have this structure..

Public Structure MyStructure
a as boolean
b as boolean
c as boolean
....
end structure

Dim Infos() As FieldInfo
Dim fi As FieldInfo
mInfos = GetType(MyStructure).GetFields

for each fi in Infos
msgbox fi.name
next

I Would "VALUE" for this Field..
You must provide an 'instance' of your structure to the FieldInfo
class:

Dim X As MyStructure
'...
for each fi in Infos
Dim Value As Object = fi.GetValue(X)
MsgBox fi.Name & "=" & Value.ToString
next
Regards,

Branco.

Jul 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
2
by: Dan | last post by:
Let's say I have a class like: class Dummy { public const string CONE = "one"; public const string CTWO = "two"; ... other stuff .... }
7
by: John | last post by:
I have a class the reads in a file and sets the values of the file into its properties. This class is used to populate the data onto a form. This form has controls created at runtime based on...
7
by: maf | last post by:
Using reflection, I'm trying to get the value for a constant in an enum. Getting the contant name works fine using: FieldInfo fieldInfos = TYPE.GetFields(); foreach(FieldInfo fi in fieldInfos...
2
by: Jason Coyne Gaijin42 | last post by:
I have seen several people looking for a way to access the Columns collection when using the AutoGenerate = true option. Some people have gotten so far as to find the private autoGenColumnsArray...
5
by: Eric Goforth | last post by:
Hello, I have a generic subroutine that I pass an object and fieldname as arguments. The subroutine then uses reflection to search for the value of the fieldname. For example: 'Calling...
3
by: RP | last post by:
Hi all, I have a class object that has member classes and structures. I basically want to be able to write some code that writes out all the names of the member variables in the class object and...
9
by: Bill Grigg | last post by:
All, Can anyone supply an example or reference to an example of using reflection to determine the data types and array lengths contained in a nested stucture in C#? Actually, it is a structure...
3
by: bill | last post by:
All, I have the following: ...... unsafe public struct Example { public double we;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.