You want to start learning C#?
You want to know how to compile a file (coded in C#) with your VB.NET program?
Just take a look at this.
First, add a textbox to your form, call it "Compile!" or what you want.
Then add those lines:
Ok, string1 doesn't exist. So now, go to the properties of your project and click on "resources" then add those lines to the value of string1:
THAT'S ALL!
Generate the .EXE of your project, open it & click on your button. The C# thing is compiled.
Don't forget to say thanks!
You want to know how to compile a file (coded in C#) with your VB.NET program?
Just take a look at this.
First, add a textbox to your form, call it "Compile!" or what you want.
Then add those lines:
Code
Imports System.CodeDom.Compiler
Imports Microsoft.CSharp
Public Class Form1
Private Sub Compile(ByVal InputSource As String, ByVal OutputPE As String)
Dim icc As CodeDomProvider = New CSharpCodeProvider()
Dim parameters As New CompilerParameters()
parameters.GenerateExecutable = True
parameters.OutputAssembly = OutputPE
'Compiling parameters
parameters.ReferencedAssemblies.Add("System.dll")
parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
parameters.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
parameters.ReferencedAssemblies.Add("System.Data.dll")
parameters.ReferencedAssemblies.Add("System.Deployment.dll")
parameters.ReferencedAssemblies.Add("System.Drawing.dll")
parameters.ReferencedAssemblies.Add("System.Xml.dll")
parameters.CompilerOptions = "/filealign:0x00000200 /optimize+ /platform:anycpu /debug- /target:winexe"
Dim results As CompilerResults = icc.CompileAssemblyFromSource(parameters, InputSource)
'Check if any errors
If results.Errors.Count > 0 Then
For Each CompErr As CompilerError In results.Errors
MessageBox.Show((("Line number " & CompErr.Line & ", Error Number: ") + CompErr.ErrorNumber & ", '") + CompErr.ErrorText & ";")
Next
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Compile(My.Resources.String1, "MyFuckingName.exe")
End Sub
End ClassOk, string1 doesn't exist. So now, go to the properties of your project and click on "resources" then add those lines to the value of string1:
Code
using System.IO;
using System.Threading;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System;
using System.Windows.Forms;
using Microsoft.VisualBasic;
using System.Diagnostics;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show ("Your program is working!", "¶_¶ rocks",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
#region Windows Form Designer generated code
private void InitializeComponent()
{
//
// Your Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}THAT'S ALL!
Generate the .EXE of your project, open it & click on your button. The C# thing is compiled.
Don't forget to say thanks!


![[Image: 2f4032b5f1170bc8fedd7e367c680327.png]](https://i.gyazo.com/2f4032b5f1170bc8fedd7e367c680327.png)