Bully
11/16/2007 9:16:00 PM
All
In VB6 I had the following types declared:
Public Type STRUCT1
x As Long
y As Long
z As Long
End Type
Public Type STRUCT2
nameArray(10) As String * 255
structArray(10) As STRUCT1
End Type
How do I convert this to VB.Net 2005?
I have come up with the following, but I keep getting an exception
when I call it. Does this conversion look ok?
<StructLayout(LayoutKind.Sequential)> _
Public Structure STRUCT1
Dim x As Integer
Dim y As Integer
Dim z As Integer
End Structure
<StructLayout(LayoutKind.Sequential)> _
Public Structure STRUCT2
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Dim
nameArray() As String
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=10)> Dim
structArray() As STRUCT1
Public Sub Initialize()
ReDim nameArray(10)
ReDim structArray(10)
End Sub
End Structure
Thanks
Jon