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

VB6
ASP
RapidScan-LogoDownload 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

Avoid Substring Out of Bounds

VB6 Left & Right functions allowed the usage of out-of-bounds indexes, automatically replacing them with the actual lower/upper bound as required. Converting these methods directly to “Substring” invocations could cause the firing of out-of-bounds exceptions which were not triggered in VB6.

If this optional feature is enabled the Visual Basic Upgrade Companion will add Math.Max and Math.Min invocations to the resulting code in order to avoid out-of-bounds exceptions. This is a brief usage example:

Original VB6 Code:

Private Sub method1()
Dim String1 As String
String1 = "this is the string content"
MsgBox Right(String1, 247)
MsgBox Left(String1, 714)
End Sub

Resulting VB.NET Code:

Private Sub method1()
Dim String1 As String = "this is the string content"
        MessageBox.Show(String1.Substring(String1.Length - Math.Min(String1.Length, 247)), Application.ProductName)
        MessageBox.Show(String1.Substring(0, Math.Min(String1.Length, 714)), Application.ProductName)
End Sub

Resulting C#.NET Code:

private void  method1(){

    string String1 = "this is the string content";
    MessageBox.Show(String1.Substring(String1.Length - Math.Min(String1.Length, 247)), Application.ProductName);
    MessageBox.Show(String1.Substring(0, Math.Min(String1.Length, 714)), Application.ProductName);
}
Talk To An Engineer