C
Chuck Ritzke
Okay, just when I thought I was starting to understand stuff. In VB6...
Type MyDataType
Dim Value1 as double
Dim Value2 as double
End Type
Dim MyData1 as MyDataType
Dim MyData2 as MyDataType
MyData1=MyData2
'...Do stuff to MyData2, MyData1
When I did this in VB6, MyData1 and MyData2 were separate values (ie if I
changed values on one subsequently, the other remained unchanged). When the
code is converted to VB.NET, it changes Type to Structure. I read
documentation and it says structures are ValueTypes and not ReferenceTypes
like classes. So I expected the same behavior as in VB6. But in my converted
code, it appears that MyData1 is just a reference to MyData2 because
subsequent changes to one, change the other. What gives? And what is the
easiest way to create a cloned MyData1 instead of just a reference to
MyData2? I hope I don't have to go thru my VB6 code and set each value
inside the structure.
TIA,
Chuck
Type MyDataType
Dim Value1 as double
Dim Value2 as double
End Type
Dim MyData1 as MyDataType
Dim MyData2 as MyDataType
MyData1=MyData2
'...Do stuff to MyData2, MyData1
When I did this in VB6, MyData1 and MyData2 were separate values (ie if I
changed values on one subsequently, the other remained unchanged). When the
code is converted to VB.NET, it changes Type to Structure. I read
documentation and it says structures are ValueTypes and not ReferenceTypes
like classes. So I expected the same behavior as in VB6. But in my converted
code, it appears that MyData1 is just a reference to MyData2 because
subsequent changes to one, change the other. What gives? And what is the
easiest way to create a cloned MyData1 instead of just a reference to
MyData2? I hope I don't have to go thru my VB6 code and set each value
inside the structure.
TIA,
Chuck