VBUC
Visual Basic Upgrade Companion. VB6 Converter for .NET & Web.

VB6
ASP
.NET7 supportDownload Now

WebMAP
Cloud Application Migration Tools Transform Desktop Applications

C#
Silverlight
Access
VB.NET
PowerBuilder
Winforms
ASP.NET Web Forms

SnowConvert
The best available tools to perform code migrations from a source database or Spark application to Snowflake.

Oracle
Spark Scala
Spark Python
SQL Server
Teradata

Get Started
There are countless ways to take advantage of BlackDiamond Studio and SnowConvert.

Migration and Other Snowflake Services
Get Up and Running with Snowpark
Using the SnowConvert Trial
Build a Cross-Platform Object Inventory

Try BlackDiamond Studio

Time to Mobilize
Free Assessment Tool

VB to .NET

Foreach Variable in C# generated code 

In C# a foreach variable can't be assignable, so to avoid a compilation error, the line must be commented. In VB.Net the iteration variable can be assigned so, this restriction is not applied.

Recommendations

Check the logic of the original VB6 function. In some cases the nothing assignation to the iteration variable is a way to stop the cycle. If this is the case use the break statement instead.For the given example, just remove the commented line and the EWI.

Sample VB6

Public Function TestCommentedLines(ByVal P() As String) As Integer
    Dim S
    Dim Count As Integer
    For Each S In P
    If Not S IsNothing Then
       MsgBox(S)
       Count = Count + 1
       S = Nothing
    End If
    Next S
    TestCommentedLines = Count
End Function

Target C#

public int TestCommentedLinesstring[] P)
{
    int Count = 0;
    foreach (string S in P)
    {
       if (S != null)
       {
         MessageBox.Show(S, Application.ProductName);
         Count++;
         //UPGRADE_NOTE: (2041) The following line was commented.
         //S = null;
        }
     }
    return Count;
}
Talk To An Engineer