I didn't find anything in this forum but was able to locate this C# code. How can I use this in VB.net?

vb Code:
  1. public static bool CompileExecutable(String sourceName)
  2.         {
  3.             //Source file that you are compliling
  4.             FileInfo sourceFile = new FileInfo(sourceName);
  5.  
  6.             //Create a C# code provider
  7.             CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp");
  8.  
  9.             //Create a bool variable for to to use after the complie proccess to see if there are any erros
  10.             bool compileOk = false;
  11.  
  12.              //Make a name for the exe
  13.              String exeName = String.Format(@"{0}\{1}.exe",
  14.              System.Environment.CurrentDirectory, sourceFile.Name.Replace(".", "_"));
  15.  
  16.              //Creates a variable, cp, to set the complier parameters
  17.              CompilerParameters cp = new CompilerParameters();
  18.  
  19.              //You can generate a dll or a exe file, in this case we'll make an exe so we set this to true
  20.              cp.GenerateExecutable = true;
  21.  
  22.              //Set the name
  23.              cp.OutputAssembly = exeName;
  24.  
  25.              //Save the exe as a physical file
  26.              cp.GenerateInMemory = false;
  27.  
  28.              //Set the compliere to not treat warranings as erros
  29.              cp.TreatWarningsAsErrors = false;
  30.  
  31.              //Make it compile
  32.              CompilerResults cr = provider.CompileAssemblyFromFile(cp, sourceName);
  33.  
  34.              //if there are more then 0 erros...
  35.              if (cr.Errors.Count > 0)
  36.              {
  37.                  //A message box shows the erros that occured
  38.                  MessageBox.Show("Errors building {0} into {1}" +
  39.                      sourceName + cr.PathToAssembly);
  40.  
  41.                  //for each error that occured in the code make a separete message box
  42.                  foreach (CompilerError ce in cr.Errors)
  43.                  {
  44.                      MessageBox.Show("  {0}" + ce.ToString());
  45.                  }
  46.              }
  47.  
  48.              //if there are no erros...
  49.              else
  50.              {
  51.                  //a message box shows compliere results and a success message
  52.                  MessageBox.Show("Source {0} built into {1} successfully." +
  53.                      sourceName + cr.PathToAssembly);
  54.              }
  55.  
  56.              //if there are erros...
  57.              if (cr.Errors.Count > 0)
  58.              {
  59.                  //the bool variable that we made in the beggining is set to flase so the functions returns a false
  60.                  compileOk = false;
  61.              }
  62.  
  63.              //if there are no erros...
  64.              else
  65.              {
  66.                  //we are returning a true (success)
  67.                  compileOk = true;
  68.              }
  69.  
  70.              //return the result
  71.              return compileOk;
  72.         }
  73.  
  74.         //this is the code for the button, but don't have to use a button to do it you can make it on load or w/e
  75.         private void button1_Click_1(object sender, EventArgs e)
  76.         {
  77.             //create a stream writer and make a .cs file
  78.             TextWriter writer = new StreamWriter(Application.StartupPath + "\\myExe.cs");
  79.  
  80.             //we'll use the WriteLine() function to write all of our code
  81.             writer.WriteLine("using System;");
  82.             writer.WriteLine("using System.Collections.Generic;");
  83.             writer.WriteLine("using System.Text;");
  84.             writer.WriteLine("namespace TestAppi");
  85.             writer.WriteLine("{");
  86.             writer.WriteLine("class Program");
  87.             writer.WriteLine("{");
  88.             writer.WriteLine("static void Main(string[] args)");
  89.             writer.WriteLine("{");
  90.             writer.WriteLine("Console.WriteLine(\"Hello World\");");
  91.             writer.WriteLine("Console.ReadLine();");
  92.             writer.WriteLine("} } }");
  93.  
  94.             //close and save the file
  95.             writer.Close();
  96.            
  97.             //create a string to the file
  98.             string file = Application.StartupPath + "\\myExe.cs";
  99.  
  100.             //compile it
  101.             CompileExecutable(file);
  102.         }