BYTEINSIGHT
GAPVelocity AI Studio helps you move from outdated tech stacks to the latest desktop, web, and cloud platforms—smarter, faster, and with less risk.
Choose a platform to see migration options:
Our comprehensive approach to application modernization, from assessment to production deployment.
Transformation Services
Not Sure Where to Start?
The VB6 AI Migrator converts VB6 library items (types and members) to .NET equivalents whenever possible. For some VB6 elements there are .NET constructs that work in a very similar way but may differ in their behavior depending on how they are used. The VB6 AI Migrator generates the EWI 1041 for these scenarios.
During the upgrade process, some class members can be mapped to .NET structures with minor behavior differences. If this EWI is displayed in a given project, the selected target structure will keep the functional equivalence of the resulting code but ma end up having small differences in some cases that may require some manual fine tuning, such as methods that are called in a different order or text that is displayed in a different font.
Public Sub DifferentBehavior()
Dim x As String
x = "string data type"
MsgBox LenB(x)
End Sub
PublicSub DifferentBehavior()
Dim x AsString = "string data type"
'UPGRADE_WARNING: (1041) LenB has a new behavior.
MessageBox.Show(CStr(Encoding.Unicode.GetByteCount(x)), Application.ProductName)
EndSub
In .Net the functions LenB, MidB, AscB, LeftB, RightB, InstrB have no direct equivalent, and their behavior would not remain consistent with VB6.
The LenB function is meant to operate on binary data stored in a string and it returns its length in bytes, that is how many bytes are required for the particular string.
In .Net String provides a Length property, this should not be confused with LenB. Each character can vary in size from 2-4 bytes according to the Unicode specification, so simplistic solutions like multiplying Length * 2 will only work for ASCII characters.
In this case, the code generated by VB6 AI Migrator is appropriate, since all strings in .Net are encoded in Unicode. So the generated code will give us the expected result.
PublicSub DifferentBehavior()
Dim x AsString = "string data type"
MessageBox.Show(CStr(Encoding.Unicode.GetByteCount(x)), Application.ProductName)
EndSub
publicvoid DifferentBehavior()
{
string x = "string data type";
//UPGRADE_WARNING: (1041) LenB has a new behavior.
MessageBox.Show(Encoding.Unicode.GetByteCount(x).ToString(), Application.ProductName);
}
In .Net the functions LenB, MidB, AscB, LeftB, RightB, InstrB have no direct equivalent, and their behavior would not remain consistent with VB6.
The LenB function is meant to operate on binary data stored in a string and it returns its length in bytes, that is how many bytes are required for the particular string.
In .Net String provides a Length property, this should not be confused with LenB. Each character can vary in size from 2-4 bytes according to the Unicode specification, so simplistic solutions like multiplying Length * 2 will only work for ASCII characters.
In this case, the code generated by VB6 AI Migrator is appropriate, since all strings in .Net are encoded in Unicode. So the generated code will give us the expected result.
publicvoid DifferentBehavior()
{
string x = "string data type";
MessageBox.Show(Encoding.Unicode.GetByteCount(x).ToString(), Application.ProductName);
}