Don,
Did you review the URL I gave you?
http://msdn.microsoft.com/library/de...eldstopic2.asp
As Herfried points out, you need both BindingFlags.In stance to say instance
fields (or BindingFlags.St atic for Shared fields) plus you need
BindingFlags.Pu blic to include public fields...
There are other BindingFlags available to include or exclude other fields
(such as inherited fields).
So be certain to review the above page.
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Don" <un*****@oblivi on.com> wrote in message
news:RdxCf.2334 35$tl.52321@pd7 tw3no...
|I figured it had something to do with that, but I couldn't find any obvious
| argument or combination of arguments that works.
|
| In my test case, I have a class (a Form, actually) with one Public
variable,
| one Friend, and one Private. Within the form's Load event I call
| Me.GetType.GetF ields().
|
| If I call GetFields with no arguments, then the fieldinfo for the Public
| variable is returned. If I call GetField with BindingFlags.No nPublic, I
get
| nothing. And if I call GetField with BindingFlags.Pu blic, I still get
| nothing. I don't know if I'm missing some other BindingFlag or not. It
| didn't behave as I expected it to, given what I could deduce from the flag
| name and the online help.
|
|
| "Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
| news:OZ******** *****@TK2MSFTNG P10.phx.gbl...
| > "Don" <un*****@oblivi on.com> schrieb:
| >>> 'GetType(MyClas s1).GetFields(. ..)'.
| >>
| >> This worked for Publicly declared variables (which is great! thanks!),
| >> but is there a way to get it to work with variables of scope Friend as
| >> well?
| >
| > Take a look at the overloaded versions of 'GetFields' which accept a
| > 'BindingFlags' parameter. Check out 'BindingFlags.N onPublic'.
| >
| > --
| > M S Herfried K. Wagner
| > M V P <URL:http://dotnet.mvps.org/>
| > V B <URL:http://classicvb.org/petition/>
|
|