Try removing BindingFlags.SetField.  IMO .SetField should be used only when you're 
trying to invoke the "setter" for a property.  If you've actually got a field, not a 
property that covers up the field, then you don't use .SetField.

Good luck.

At 08:33 AM 10/13/2003 +0200, Kjell Arild Tangen wrote
>I am trying to set a static field using Type.InvokeMember, but get an error:
>"Only the field value can be specified to set a field value.
>Parameter name: invokeAttr"
>I get the above error when using binding flag =  
>BindingFlags.Public|BindingFlags.Static|BindingFlags.SetField
>I don't see any other sensible binding flag value that I can set.
>
>The class I am using is as simple as can be, i.e. a class with just a public static 
>member.
>Anyone that has a working example of using InvokeMember to set a static field?
>
>Regards,
>Kjell Tangen


J. Merrill / Analytical Software Corp

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
NEW! ASP.NET courses you may be interested in:

2 Days of ASP.NET, 29 Sept 2003, in Redmond
http://www.develop.com/courses/2daspdotnet

Guerrilla ASP.NET, 13 Oct 2003, in Boston
http://www.develop.com/courses/gaspdotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to