Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2008 accessing structures in an array

$
0
0
Hello

Am having trouble accessing members of structures that are in an array. My app will be receiving several strings of information that will each be subdivided and the info contained within categorized in structures. The number of strings is unknown (but average around 5-10). Each string will be put into an index of the array. The strings will then be split up into smaller strings (of an unknown number, not more than 10) and the smaller strings will be dissected into bits of info and housed in it's own Structure. Although not reflected in the code below, there will be variables to receive the yet unknown numbers (of strings and sub strings), all discovered during a For Loop (hence all of the redim(s)).

Although I am reasonably comfortable working with structures and simple arrays, I can't seem to access the members of the structures to assign them value. I have also posted a jpg to illustrate that the tree I am building appears (to me) to be working. Can someone suggest a line that would allow me to assign theDetails(0).name inside the array theList(0) a string?

Thanks


Code:

Public Class Form1
    Public Structure details
        Dim name As String
        Dim xLoc As Integer
        Dim yLoc As Integer
    End Structure
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim theList() As Array
        ReDim theList(3)

        With theList(0)
            Dim theDetails() As details
            ReDim theDetails(2)
            theList(0) = theDetails
        End With

        With theList(1)
            Dim theDetails() As details
            ReDim theDetails(1)
            theList(1) = theDetails
        End With

    End Sub
End Class

Name:  local.jpg
Views: 26
Size:  66.0 KB
Attached Images
 

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>