Skip to content

C# to VB.Net Code Converter free

    C# to VB Code Converter. Automate code converting. Download this freeware and covert C# files, project into for free.

    Download from

    On the other hand for more info about code converting see Code Converting

    Before Using C# to VB Code Converter:

    • First, make sure that you can compile your code and run it well before starting convert.
    • However, 100% code conversion maybe get most times but not always. Most times, you need post-conversion fixing.
    • On the other hand, no converters can guarantee 100% conversion.

    Demo conversion of C# to VB:

    You can not convert a partial code convert. The code should be in class and in the method.


    class Class1{
        void sub1(){
            //your code starts
            int x =0;
           //your code ends

    The result in Visual Basic

    'Visual Basic
    'C# to VB.Net Code Converter
    Class Class1
        Sub sub1()
            'your code starts.
            Dim x As Integer = 0
            'your code ends.
        End Sub
    End Class

    Demo 2:

    //C# to VB.Net Code Converter
    namespace WindowsFormsApplication1{
        partial class Form1
            private System.ComponentModel.IContainer components = null;
    		private System.Windows.Forms.TextBox textbox1;
            private System.Windows.Forms.TextBox textbox2;
            protected override void Dispose(bool disposing)
                if (disposing && (components != null))
            private void InitializeComponent()
                this.textbox1 = new System.Windows.Forms.TextBox();
                this.textbox2 = new System.Windows.Forms.TextBox();
                // textbox1
                this.textbox1.Location = new System.Drawing.Point(30, 30);
                this.textbox1.Name = "TEXTBOX1";
                this.textbox1.Size = new System.Drawing.Size(80, 20);
                this.textbox1.TabIndex = 0;
                // textbox2
                this.textbox2.Location = new System.Drawing.Point(30, 60);
                this.textbox2.Name = "textbox";
                this.textbox2.Size = new System.Drawing.Size(80, 20);
                this.textbox2.TabIndex = 1;
                this.textbox2.TextChanged += new System.EventHandler(this.textbox_TextChanged);
                // 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";
            public Form1()
            private void textbox_TextChanged(object sender, EventArgs e)
                string x = "";
                string X = "";

    The result in visual basic

    'Visual Basic
    'C# to VB.Net Code Converter
    Namespace WindowsFormsApplication1
    	Partial Class Form1
    		Private components As System.ComponentModel.IContainer = Nothing
    		Private textbox1 As System.Windows.Forms.TextBox
    		Private textbox2 As System.Windows.Forms.TextBox
    		Protected Overrides Sub Dispose(disposing As Boolean)
    			If disposing AndAlso (components IsNot Nothing) Then
    			End If
    		End Sub
    		Private Sub InitializeComponent()
    			Me.textbox1 = New System.Windows.Forms.TextBox()
    			Me.textbox2 = New System.Windows.Forms.TextBox()
    			' textbox1
    			Me.textbox1.Location = New System.Drawing.Point(30, 30)
    			Me.textbox1.Name = "TEXTBOX1"
    			Me.textbox1.Size = New System.Drawing.Size(80, 20)
    			Me.textbox1.TabIndex = 0
    			' textbox2
    			Me.textbox2.Location = New System.Drawing.Point(30, 60)
    			Me.textbox2.Name = "textbox"
    			Me.textbox2.Size = New System.Drawing.Size(80, 20)
    			Me.textbox2.TabIndex = 1
    			AddHandler Me.textbox2.TextChanged, New System.EventHandler(AddressOf Me.textbox_TextChanged)
    			' Form1
    			Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F)
    			Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
    			Me.ClientSize = New System.Drawing.Size(284, 262)
    			Me.Name = "Form1"
    			Me.Text = "Form1"
    		End Sub
    		Public Sub New()
    		End Sub
    		Private Sub textbox_TextChanged(sender As Object, e As EventArgs)
    			Dim x__1 As String = ""
    			Dim X__2 As String = ""
    		End Sub
    	End Class
    End Namespace

    Case sensitive C# to VB.Net (Visual Basic)

    Specifically, if two var in c# differs only in the cases of the letters, then the converter will automatically rename if needed.

    Event Handler C# to VB.Net (Visual Basic)

    In general, the event C# handler converts:

    //C# 444
    this.textbox2.TextChanged += new System.EventHandler(this.textbox_TextChanged);

    Visual Basic:

    'Visual Basic
    AddHandler Me.textbox2.TextChanged, New System.EventHandler(AddressOf Me.textbox_TextChanged)

    What is a C# code that has no equivalent in VB?

    * Fixed-size buffers and fixed statement has no equivalent in Visual Basic:

    private fixed char name[30]

    * fixed Statement in C# has no equivalent in Visual Basic:
    The fixed statement sets a pointer to a managed variable and “pins” that variable during the execution of the statement.

    //C# to VB.Net Code Converter
    unsafe private static void ModifyFixedStorage(){
        // Variable pt is a managed variable, subject to garbage collection.
        Point pt = new Point();
        // Using fixed allows the address of pt members to be taken,
        // and "pins" pt so that it is not relocated.
        fixed (int* p = &pt.x){
            *p = 1;

    * C# Generic indexers and properties have no equivalent in VB:

    public T this[string key] { 
    	get { /* Return generic type T. */ } 
    public T GetItem<T>(string key){ 
    	/* Return generic type T. */ 

    * C# Generic operators have no equivalent in visual basic:

    public static T operator +<T>(T a, T b)	{
    // Do something with a and b that makes sense for operator + here

    * C# #undef has no equivalent in visual basic.
    * C# volatile/checked/unchecked/stackalloc has no equivalent in visual basic:
    Using the unchecked statement with constant expressions overflow, it unchecks at compile time or runs time and the return value is differs
    * C# unsafe block has no equivalent in visual basic:

    unsafe static void FastCopy ( byte[] src, byte[] dst, int count )
    // unsafe context: can use pointers here

    * C# extern alias has no equivalent in Visual Basic:
    It sometimes is necessary to reference two versions of assemblies that have the same fully qualified type names, for example, when you need to use two or more versions of an assembly in the same application. By using an external assembly alias, the namespaces from each assembly can be wrapped inside root-level namespaces named by the alias, allowing them to be used in the same file
    To reference two assemblies with the same fully qualified type names, we must specify an alias on the command line:


    This creates the external aliases GridV1 and GridV2. To use these aliases from within a program, reference them using the extern keyword. For example:

    extern alias GridV1; 
    extern alias GridV2;

    * C# overloading ++ or — operator in has no equivalent in Visual Basic: ++ & — can converted easily but overloading is not.

    * C# ?? operator has no equivalent in Visual Basic

    What is a Visual Basic code that has no equivalent is C#?

    * Parameterized Properties in Visual Basic have no equivalent in C#

    'C# to VB.Net Code Converter
    Public Property MyProperty(ByVal A As String) As String
            Return 2 * A
        End Get
        Set(ByVal value As String)
            A = value / 2
        End Set
    End Property

    * Numeric labels, On Error, Resume Next, Continue, and Err object has no equivalent in C#

    'C# to VB.Net Code Converter 
    Sub Test()
        On Error Resume Next
        On Error GoTo 0
        On Error GoTo -1
        On Error GoTo EH
        Exit Sub
        Resume Next
    End Sub

    * IIf in Visual Basic is some who defer than if in C#.

    A = IIf(E, B, A)

    * ReDim Preserve has no built-in equivalent in C#

    ReDim Preserve A(9)

    * Select Case in Visual Basic is much more flexible than c# switch  and many Visual Basic Select Case blocks cannot be converted to switch

    'C# to VB.Net Code Converter 
    Select Case A
        Case 1 To 10
        Case Is < 2 * A
        Case Is > 30
    End Select

    * On the other hand, Visual Basic procedures local static variables have no built-in equivalent in C# but class-level private variable may use.

    Sub Test()
        Static InUse As Boolean = False
        If InUse Then Exit Sub
        'Run Once code
        InUse = True
    End Sub

    * Visual Basic With has no equivalent in C#.

    With Me
        .Width = 10
        .Top = 0
    End With

    * Visual Basic Import shared class member is not supported in C#

    Imports WindowsApplication1.Form1

    * Visual Basic Exit try

    * in the same way, Visual Basic Exit statements that not matching the immediately enclosing block.

    * While Visual Basic Member names can be the same as their enclosing type, but C# can’t.

    * Visual Basic #Const can be set to any value but in C# accept constants only

    #Const C = 2 * A

    * Visual Basic MyClass has no equivalent in C# (sometimes using this is OK)

    * In C#, an object cannot reference itself in its class-level declarations: You cannot use this in class-level declarations in C#.

    * In C#, an object cannot reference its base class in its class-level declarations: You cannot use base in class-level declarations in C#.

    * Numeric labels are not allowed in C#: You must change the label to be a standard C# identifier.

    * Visual Basic &O has no equivalent in C#

    * Visual Basic When has no equivalent in C#

    * Visual Basic has some operator that is not present in C# and can’t be overloaded in C# in any way such as (integer division (VB \), Like, exponentiation (VB ^))

    * In Visual Basic we may use a method with the same name as the class name. But C# uses the class name for the constructor in C# and we can’t use it for any other method or property in C#.

    * Visual Basic integer casts convert ‘True’ to -1, but System. Convert methods convert ‘True’ to 1.

    C# and Visual Basic Language Equivalents and Comparison:

    1. Language Equivalents
    2. Comparison of C# and Visual Basic
    3. Complete Comparison for Visual Basic.NET & C#

    Discussion and feedback about C# to VB.Net Code Converter free

    End of the article C# to VB.Net Code Converter free