Is it event possible to import text as code, then add it in a sub in vb.net?
If I have a .txt file filled with code can I import it programatically (by a button)?
What I need is to make vb.net to accept that script (txt file), and use it to declare variables and make functions/subs – that’s all I need to.
You can do this kind of thing using the CodeDom objects. The CodeDom objects allow you to dynamically generate assemblies at run-time. For instance, if you make an interface
Then, you create a method, like this:
Now, you can call it like this:
Obviously, instead of building the code in a string builder, you could load it out of a text file, like this: