Click here to Skip to main content
15,029,433 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I declare a fixed length variable array? I'm stuck, any help will be appreciated:

VB
Structure MyInformation
<VBFixedString(4),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst:=4)> Public ReturnStatus As String
<VBFixedString(6),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValTStr,SizeConst:=6)> Public VariableA As String
                Public VariableB(3) As String * 6  Not sure how to declare
End Structure
Posted
Updated 24-May-12 23:45pm
v5

Similar discussion: How can i declare string with size.[^]
   
Comments
to.areeb 25-May-12 5:22am
   
Not similar. here is different situation
Use the following Syntax to Declare Array
<vbfixedarray("Size")>

For Example :
VB
Public Class Form1 
    Public Structure ExampleStructure 
        <vbfixedarray(10)> Public myArray() As String 
        <vbfixedstring(20)> Public myString As String 
    End Structure 
End Class

To Use this create new Instance :
Dim NewExample As New ExampleStructure

For more help try this:
http://msdn.microsoft.com/en-us/library/f51fe7sf(VS.80).aspx[^]
http://msdn.microsoft.com/en-us/library/z6cfh6e6(v=vs.71).aspx[^]
   
v2
Comments
to.areeb 25-May-12 6:09am
   
Thanks Manoj for your reply you r right but my problem is I want array whoes string also fixed. like my array size is 5 and at same time i want my string lenth also fixed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900