Run code entered in textbox

  • Thread starter Thread starter jed
  • Start date Start date
J

jed

I want to enter code in a textbox and then be able to execute that
code.How can i convert the text in the textbox to code that can be
executed?
 
I want to enter code in a textbox and then be able to execute that
code.How can i convert the text in the textbox to code that can be
executed?

The only way I know to do that is to send the code to the Microsoft
Scripting Control.
 
I want to enter code in a textbox and then be able to execute that
code.How can i convert the text in the textbox to code that can be
executed?
1 Write the text to a .cs file.
2 Call the C# compiler with the command line interface to compile the
..cs file
3 If the compile succeeded then run the .exe file the compiler
created.

To call another program from within a C# program use something like:

using (Process proc = Process.Start("progname.exe",
"prog parameters"))
{
proc.WaitForExit();
if(proc.ExitCode != 0) throw new Exception();
}

The Process class is in System.Diagnostics.

rossum
 
Back
Top