FRoeCassNet
Programmer
I recently upgraded from VB6 to VB.NET and I'm having trouble figuring out how to pass a structure to a COM object.
In VB6 I used:
-- Structure --
Private Type ParamInfo
sVal As String * 40
lVal As Long
End Type
Private Type ParamInfoStr
Buffer As String * 42
End Type
-- Property --
Private Property Get ParamData() As Variant
Dim b() As Byte
Dim p1 As ParamInfo
Dim p2 As ParamInfoStr
p1.sVal = "Test"
p1.lVal = -1
LSet p2 = p1
b = p2.Buffer
ParamData = b
End Property
This would return the full structure as an 84 byte array.
How do I do this in VB.NET? I've tried playing with structures, unions, etc. but can't seem to figure out how to convert my structure into a byte array that contains all the data.
Thanks in advance for any help.
In VB6 I used:
-- Structure --
Private Type ParamInfo
sVal As String * 40
lVal As Long
End Type
Private Type ParamInfoStr
Buffer As String * 42
End Type
-- Property --
Private Property Get ParamData() As Variant
Dim b() As Byte
Dim p1 As ParamInfo
Dim p2 As ParamInfoStr
p1.sVal = "Test"
p1.lVal = -1
LSet p2 = p1
b = p2.Buffer
ParamData = b
End Property
This would return the full structure as an 84 byte array.
How do I do this in VB.NET? I've tried playing with structures, unions, etc. but can't seem to figure out how to convert my structure into a byte array that contains all the data.
Thanks in advance for any help.