pb resizing FixedArray

  • Thread starter Thread starter David Scemama
  • Start date Start date
D

David Scemama

Hi,

I have the following structure:
Structure CCat
Public code As Short
<VBFixedString(17)> Public nom As String
<VBFixedArray(30)> Public scat() As String ' scat is a N dimention
table of exactly 30 caracters

Public Sub Initialize(ByVal sizeSCat As Integer)
ReDim scat(sizeSCat)
End Sub
End Structure

in my code, he is what I'm trying to do:
Dim categ As CCat
Dim x As Integer = Len(categ)
categ.Initialize(5) ' the dimention
of the table is 5
x = Len(categ)

x has the same value before and after the resize. And naturally, when I use
a FileGet function to retreive my data, I have a record length error.

Can someone tell me what I did wrong ?

Thanks a lot
David
 
Hi David,

Len (categ) will give you the size of a CCat, ie. its contents.
Unfortunately scat, which is part of the contents, is not wholly within a
CCat, as it were. The actual array of strings is <associated> with the
structure but not part of it. The size of CCat is the size of nom, a fixed
length string, and scat, a reference variable. As such, it is constant.

Regards,
Fergus
 
Back
Top