Problem with structures in arrays

Jay1b

Contributor
Joined
Aug 3, 2003
Messages
640
Location
Kent, Uk.
Could somebody please tell me how i should be doing this please?

I am trying to put
Public Fields_OTT() As StructField
Public Fields_SSN() As StructField
Public Fields_BIW() As StructField
into the array Field_Type - but i am doing it wrong

Visual Basic:
    Public Structure StructField
        Public FieldName As String
        Public FieldStartPos As Integer
        Public FieldLength As Integer
    End Structure

    'Creates fields of type object - created above
    Public Fields() As StructField
    Public Fields_OTT() As StructField
    Public Fields_SSN() As StructField
    Public Fields_BIW() As StructField

    Public Field_Type As Array = Fields_OTT, Fields_SSN, fields_biw

Thanks
 
Are you trying to put the three arrays into a 1D array, or just to arrange them into a 2D array?
Maybe something like this will work (a guess though).
Public Field_Type() As StructField = {Fields_OTT, Fields_SSW, Fields_BIW}
:)
 
Try this

What about trying it like this:

Visual Basic:
Public Structure StructField
        Public FieldName As String
        Public FieldStartPos As Integer
        Public FieldLength As Integer
End Structure

Public Structure Blah
    Public Fields_OTT() As StructField
    Public Fields_SSN() As StructField
    Public Fields_BIW() As StructField
end Structure

dim WhateverSize as Integer = 100

'Declare your Field_Type variable
dim Field_Type as Blah

'Or declare it like: dim Field_Type(WhateverSize) as Blah

'Now set the size of the arrays since you can't define them within the structure
Redim Field_Type.Fields_OTT(WhateverSize)
Redim Field_Type.Fields_SSN(WhateverSize)
Redim Field_Type.Fields_BIW(WhateverSize)

-Falcon
 
Last edited:
Back
Top