Code Converter

Welcome to our official feedback forum for the code converter. If you spot problems with the converter, just leave a note here. Please make sure you include a code sample*

These don't convert correctly for...

You've used all your votes and won't be able to post a new idea, but you can still search and comment on existing ideas.

There are two ways to get more votes:

  • When an admin closes an idea you've voted on, you'll get your votes back from that idea.
  • You can remove your votes from an open idea you support.
  • To see ideas you have already voted on, select the "My feedback" filter and select "My open ideas".
(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  1. Thanks! We're now processing your upload

    Even when converting a simply one line this is displayed and never converts the code. Thanks!

    134 votes
    Vote
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      You have left! (?) (thinking…)
      19 comments  ·  Flag idea as inappropriate…  ·  Admin →
    • Array brackets

      VB.NET Array parentheses do not translate to C# brackets

      Example (VB.NET):

      Dim pts(2) As Point
      pts(0) = New Point(left + arrowWidth / 2 - 2 -extra - 2, top + height / 2 - 1)
      pts(1) = New Point(left + arrowWidth / 2 + 3 +extra - 1, top + height / 2 - 1)
      pts(2) = New Point(left + arrowWidth / 2 - 1,(top + height / 2 - 1) + 3 + extra)

      Translates to (C#):

      Point[] pts = new Point[3];
      pts(0) = new Point(left + arrowWidth / 2 - 2 - extra - 2, top + height…

      93 votes
      Vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        I agree to the terms of service
        Signed in as (Sign out)
        You have left! (?) (thinking…)
        2 comments  ·  Flag idea as inappropriate…  ·  Admin →
      • AddHandler

        Please use AddHandler statements when converting C# event handlers to VB text...

        For example, instead of converting a C# handler to this...

        queue.QueueItemAvailable += Me.ContinueAt

        do this...

        AddHandler queue.QueueItemAvailable, Addressof Me.ContinueAt

        59 votes
        Vote
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          I agree to the terms of service
          Signed in as (Sign out)
          You have left! (?) (thinking…)
          2 comments  ·  Flag idea as inappropriate…  ·  Admin →
        • Implement conversion for yield statement into VB.NET

          Using an IEnumerable collection and returning that instead

          26 votes
          Vote
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            I agree to the terms of service
            Signed in as (Sign out)
            You have left! (?) (thinking…)
            1 comment  ·  Flag idea as inappropriate…  ·  Admin →
          • trim

            The syntax in VB is

            returnValue = inputValue.Trim

            When converting to C# it is not adding the "()" to the end of "Trim"

            21 votes
            Vote
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              I agree to the terms of service
              Signed in as (Sign out)
              You have left! (?) (thinking…)
              under review  ·  3 comments  ·  Flag idea as inappropriate…  ·  Admin →
            • ViewState, Session or Request.Params not arrays

              In my example below, none of the ViewState, Session or Request Params (arrays) have their round brackets converted to square brackets.

              Example:
              Protected Property CurrentSortColumn() As String
              Get
              If (ViewState("SortColumn") <> Nothing) Then
              Return ViewState("SortColumn").ToString()
              Else
              ViewState("SortColumn") = "ADD_BOOK_ID"
              Return "ADD_BOOK_ID"
              End If
              End Get

              Set(ByVal value As String)
              ViewState("SortColumn") = value
              End Set

              End Property

              Private Sub Test

              ParentControlID = Request.Params("ParentCtlID")

              If DirectCast(Session("USER_TOKEN"), Int32) > 0 Then
              UserCanEditAddBook = True
              End If

              End Sub

              20 votes
              Vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                I agree to the terms of service
                Signed in as (Sign out)
                You have left! (?) (thinking…)
                2 comments  ·  Flag idea as inappropriate…  ·  Admin →

                Unfortunately we have no reliable way of knowing for sure that ViewState is an array rather than a method. We could guess for certain variable names (ViewState, Request etc) but this could confuse the issue further were these to conflict with actual methods… what do people think?

              • Suggest code to make event handlers work (VB.Net -> C#)

                The converter could suggest the code needed to bind an event handler.

                Example:

                Private Sub SomeObject_SomeEvent(Arguments as Object) Handles SomeObject.SomeEvent

                The following code could be suggested (in a comment):
                SomeObject.SomeEvent += SomeObject_SomeEvent;

                19 votes
                Vote
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  I agree to the terms of service
                  Signed in as (Sign out)
                  You have left! (?) (thinking…)
                  1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                • Cannont convert Nullable property using ?

                  When trying to convert from VB.Net to C# (or vice versa), if you have a nullable property that is created using the ? and not Nullable<> the post back on your page is not ready correctly.

                  Public Property CurrentDate As DateTime?

                  I should be able to pass that and get

                  public DateTime? CurrentDate { get; set; }

                  17 votes
                  Vote
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    I agree to the terms of service
                    Signed in as (Sign out)
                    You have left! (?) (thinking…)
                    1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                  • Array Problem with StringDictionary

                    I had a bit of an issue with a StringDictionary collection when converting.

                    Original Code: (VB)
                    sServiceName = Me.Context.Parameters.Item("name")
                    sServiceDescription = Me.Context.Parameters.Item("description")
                    sServiceDisplayName = Me.Context.Parameters.Item("displayname")

                    Converted Code: (C#)
                    sServiceName = this.Context.Parameters.Item("name");
                    sServiceDescription = this.Context.Parameters.Item("description");
                    sServiceDisplayName = this.Context.Parameters.Item("displayname");

                    Correct Code: (C#)
                    sServiceName = this.Context.Parameters["name"];
                    sServiceDescription = this.Context.Parameters["description"];
                    sServiceDisplayName = this.Context.Parameters["displayname"];

                    In C#, Array.Item(key) is not valid. It should be Array[key].

                    15 votes
                    Vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      I agree to the terms of service
                      Signed in as (Sign out)
                      You have left! (?) (thinking…)
                      0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                    • Code converter is broken again.

                      "Processing" message never goes away, converted code is never displayed. Same for Chrome and IE.
                      July 18, 2014

                      14 votes
                      Vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        I agree to the terms of service
                        Signed in as (Sign out)
                        You have left! (?) (thinking…)
                        4 comments  ·  Flag idea as inappropriate…  ·  Admin →
                      • Delegates

                        If button.InvokeRequired Then
                        Dim o As Object = scriptableButton.Invoke(New System.Windows.Forms.MethodInvoker(UserInterfaceCode))
                        End If

                        Should be

                        If button.InvokeRequired Then
                        Dim o As Object = scriptableButton.Invoke(New System.Windows.Forms.MethodInvoker(addressof UserInterfaceCode))
                        End If

                        13 votes
                        Vote
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          I agree to the terms of service
                          Signed in as (Sign out)
                          You have left! (?) (thinking…)
                          0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                        • VB's floating-point division operator is converted to C#'s integer division.

                          'VB
                          Dim a As New TimeSpan(1000L)
                          Dim b As New TimeSpan(2000L)
                          Dim d As Double = a.Ticks / b.Ticks 'd = 0.5

                          //Converted to C#
                          TimeSpan a = new TimeSpan(1000L);
                          TimeSpan b = new TimeSpan(2000L);
                          double d = a.Ticks / b.Ticks 'd = 0

                          13 votes
                          Vote
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            I agree to the terms of service
                            Signed in as (Sign out)
                            You have left! (?) (thinking…)
                            1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                          • initailized object

                            c# code

                            var textBox = new RibbonTextBox() { Label = "Label", Text = "Text", TextBoxWidth = 150 };

                            incorrectly converted to vb.net as

                            Dim textBox = New RibbonTextBox() With { _
                            Key .Label = "Label", _
                            Key .Text = "Text", _
                            Key .TextBoxWidth = 150 _
                            }

                            where "Key" is not needed, should be:

                            Dim textBox = New RibbonTextBox() With {.Label = "Label", .Text = "Text", .TextBoxWidth = 150}

                            12 votes
                            Vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              I agree to the terms of service
                              Signed in as (Sign out)
                              You have left! (?) (thinking…)
                              1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                            • Puts 'As var' improperly into converted code

                              foreach (var w in res1) Console.WriteLine(" ");

                              Converts incorrectly to VB as:

                              For Each w As var In res1
                              Console.WriteLine(" ")
                              Next

                              Which comes up invalid

                              12 votes
                              Vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                I agree to the terms of service
                                Signed in as (Sign out)
                                You have left! (?) (thinking…)
                                0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                              • C#.NET to python

                                I am not able to convert C# code to Python..

                                11 votes
                                Vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  I agree to the terms of service
                                  Signed in as (Sign out)
                                  You have left! (?) (thinking…)
                                  2 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                • Missing 'With' Object Initializers

                                  In C#:
                                  StringFormat sfCenter = new StringFormat() {Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };

                                  Converted to VB.NET:
                                  sfCenter As New StringFormat()

                                  Expected result:
                                  sfCenter As New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}

                                  11 votes
                                  Vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    I agree to the terms of service
                                    Signed in as (Sign out)
                                    You have left! (?) (thinking…)
                                    0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                  • i++; fails

                                    When converting the following from C# to VB.NET it fails to convert correctly.
                                    int i=5;
                                    int j=i++;
                                    //i=6 and j=5
                                    It sets Dim j = System.Math.Max(System.Threading.Interlocked.Increment(i),i-1)

                                    Not possible for i-1 to be greater than i+1

                                    9 votes
                                    Vote
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      I agree to the terms of service
                                      Signed in as (Sign out)
                                      You have left! (?) (thinking…)
                                      1 comment  ·  Flag idea as inappropriate…  ·  Admin →
                                    • I have been trying to convert from C# to VB.net for last few days and converter just keeps spinning.

                                      Not having any luck converting code for last few days.
                                      Trying to convert from C# to VB.net.
                                      Used small code snippets and still no results.

                                      Thank you,

                                      9 votes
                                      Vote
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        I agree to the terms of service
                                        Signed in as (Sign out)
                                        You have left! (?) (thinking…)
                                        4 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                      • The Converter has stopped working ,I have not been able to use it for 3 + weeks (01/06/2015)

                                        The Converter has stopped working ,I have not been able to use it for 3 + weeks (01/06/2015)

                                        9 votes
                                        Vote
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          I agree to the terms of service
                                          Signed in as (Sign out)
                                          You have left! (?) (thinking…)
                                          3 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Joining strings

                                          Just realised (and also learned) that there's a small error when converting VB's Strings.Join into C# code.
                                          The VB code:

                                          Dim message As String = Join(anArrayList.ToArray, ",");

                                          converts in C# to:

                                          string message = Strings.Join(anArrayList.ToArray(), ",");

                                          where it should be:

                                          string message = String.Join(",", anArrayList.ToArray());

                                          9 votes
                                          Vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            I agree to the terms of service
                                            Signed in as (Sign out)
                                            You have left! (?) (thinking…)
                                            0 comments  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3 4 5 18 19
                                          • Don't see your idea?

                                          Code Converter

                                          Feedback and Knowledge Base