Home All Groups Group Topic Archive Search About

declared initial size of array in structure

Author
20 Dec 2006 7:55 AM
Farsad
Hi
how can I declared initial size of array in structure. I have below code in
c++ and translate this to vb.net. but get this error: "Arrays declared as
structure members cannot be declared with an initial size"

c++:
  typedef struct{
        prWChar           DeviceInternalName[512];
        prWChar              ModelName[32];
        prUInt16          Generation;           
    }prDeviceInfoTable;

vb.net:
  Structure prDeviceInfoTable
        Dim DeviceInternalName(0 to 511) As Char
        Dim ModelName(0 to 31) As Char
        Dim Generation As Integer
    End Structure

how can I?
Very thanks

Author
20 Dec 2006 9:04 PM
Herfried K. Wagner [MVP]
"Farsad" <Far***@discussions.microsoft.com> schrieb:
> how can I declared initial size of array in structure. I have below code
> in
> c++ and translate this to vb.net. but get this error: "Arrays declared as
> structure members cannot be declared with an initial size"
>
> c++:
>  typedef struct{
>    prWChar           DeviceInternalName[512];

\\\
Imports System.Runtime.InteropServices
....
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=512)> _
Public DeviceInternalName() As Char
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>