This is making no sense and I'm drunk and tired too (which isn't helping).
If I have the following code:
The problem I'm having is that SomethingOnce does not match with SomethingArray(x)... I'm getting loads of data type misalignments. Which is silly, as whatever auto-padding VB6 adds should be identical, so there should be no problems copying the data. Only it doesn't work (note that in my real code, Something is a fairly complex set of some data types, other UDTs, and arrays of UDTs). What is really curious is that changing the structure of the UDTs that Something is made from (by manually adding padding bytes) affects the data misalignments. I was hoping to find the right padding which would cause the problem to go away but I've had no luck.
This problem seemed to come out of the blue, the copy worked fine until I added an extra UDT to Something, and now everything has gone to pot. I just don't understand why.
Any ideas?
If I have the following code:
Public Type Something
Lots of variables....
End Type
Public SomethingArray() As Something
Public SomethingOnce As Something
Public Sub SomethingElse
'populate SomethingArray here...
SomethingOnce = SomethingArray(x)
End Sub
The problem I'm having is that SomethingOnce does not match with SomethingArray(x)... I'm getting loads of data type misalignments. Which is silly, as whatever auto-padding VB6 adds should be identical, so there should be no problems copying the data. Only it doesn't work (note that in my real code, Something is a fairly complex set of some data types, other UDTs, and arrays of UDTs). What is really curious is that changing the structure of the UDTs that Something is made from (by manually adding padding bytes) affects the data misalignments. I was hoping to find the right padding which would cause the problem to go away but I've had no luck.
This problem seemed to come out of the blue, the copy worked fine until I added an extra UDT to Something, and now everything has gone to pot. I just don't understand why.
Any ideas?