Trouble finding length of structure object in VB 2005
- From: "fripper" <young@xxxxxxxxxxx>
- Date: Tue, 28 Mar 2006 18:47:42 -0500
I have a VB .Net 2003 program that I am upgrading to VB 2005. It includes a
data structure that defines an object containing a number of fixed length
(stirng) fields. Somehting like the following:
(this is what the upgrade wizard created from by VB 2003 code)
Private Structure DataRecord
<VBFixedString(20)System.Runtime.InteropServices.MarshalAs
_(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=20)>
Public DateEntered() As Char
<VBFixedString(1), System.Runtime.InteropServices.MarshalAs
_(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=1)>
Public Space1() As Char
<VBFixedString(12), System.Runtime.InteropServices.MarshalAs
_(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=12)>
Public Amount() As Char
End Structure
Then I define an object as a DataRecord:
Dim MyRecord as DataRecord
When I calculate the length of MyRecord [intLength = len(MyRecord)] I get a
value of 12. I expected to get a value of 33. As near as I can see from
the documentation the len function in VB 2005 works like it does in VB 2003.
Can someone enlighten me on where I have gone astray?
Many thanks.
.
- Prev by Date: Re: Oledb VS Sql. Oledb works with Sql Server; Sql doesn't...why
- Next by Date: Re: Printing Multiple Images
- Previous by thread: Re: Oledb VS Sql. Oledb works with Sql Server; Sql doesn't...why
- Next by thread: Problems with TCP Listener
- Index(es):
Relevant Pages
|