How do I set a field value in a VB.NET module using Reflection?
i think it should be very similar to the C# code
objectwithfield.GetType().GetField("field").SetValue(objectwithfield, newValue)
@user287107 was close but this is what works:
Dim ass As Assembly = Assembly.Load("AssemblyNameWhereModuleResides")
Dim moduleType as Type = ass.GetType("MyNameSpaceIfApplicable.MyModuleName")
moduleType.GetField("field").SetValue(Nothing, newValue)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With