April 24th, 2012, 01:17 AM
VB.NET 2008: Importing Code From a Text File
I know I'm probably up the creek without a paddle here, but is it at all possible in VB.NET 2008 to import code from a text file? I know it doesn't sound practical, but for a project I'm experimenting with, the code that gets executed all depends on particular options being chosen, and there will be a lot of options to choose from, and the code won't be the same for each.
UPDATE: Never mind, I'm pretty sure now this can't be done, at least not easily.
April 28th, 2012, 10:46 AM
.Net offers two alternatives:
One is to load a class library (dll) at runtime using Assembly.LoadFile()
The other is to use a domain specific language.
Both allow you to load arbitrary code at runtime in safer context.
Its possible but not recommended.Actually the main thing is SREAMREADER AND STREAMWRITER which basically helps you to read and write the file.
Dim FileReader As StreamReader
Dim results As DialogResult
results = OpenFileDialog1.ShowDialog
If results = DialogResult.OK Then
'Code to be executed if OK button was clicked
'Code to be executed if Cancel button was clicked
I think it will help you