VB to .NET

ISSUE #1002

LSet cannot assign one type to another.

Description

This occurs when a type is assigned to another, using the LSet Function. LSet Function just copies all the source bytes from one type, and then assigns then makes that the other type points to the copy.

Recommendations

You can manually assign all the values and pass them from a class to another. You could require byte functions, so please be sure of how the function passes the data from one type to another. For example if you have a type that contains an string and the other has an array of string of lenght 2, then you must make a funtion that splits and assigns the first array into 2 characters pieces, and then assign them at them to the second type array.

Sample VB6

PublicSub LSetTest()
   Dim T1 As tipo1
   Dim T2 As tipo2
   T1.campo = "Valor"
   LSet(T2 = T1)
EndSub

Target VB.NET

PublicSub LSetTest()
   Dim T1 As tipo1 = tipo1.CreateInstance()
   Dim T2 As tipo2 = tipo2.CreateInstance()
   T1.campo.Value = "Valor"
   'UPGRADE_ISSUE: (1002) LSet cannot assign one type to another.
   T2 = LSet(T1)
EndSub

Expected VB.NET

Undetermined expected behavior.

Target C#

staticpublicvoid LSetTest()
{
   tipo1 T1 = tipo1.CreateInstance();
   tipo2 T2 = tipo2.CreateInstance();
   T1.campo.Value = "Valor";
   //UPGRADE_ISSUE: (1002) LSet cannot assign one type to another.
   T2 = LSet(T1);
}

Expected C#

Undetermined expected behavior.

Talk To An Engineer