Searching and updating structures in an arraylist

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Emily

    Searching and updating structures in an arraylist

    I am new to VB.NET and I need help finding and updating
    values in an arraylist.

    My arraylist is called arrVarInfo and holds data in this
    structure type:

    Public Structure VarInfo
    Dim Name As String
    Dim Format As String
    Dim Desc As String
    Dim Type As String
    Dim Len As String
    Dim BegPos As String
    Dim EndPos As String
    End Structure

    I have no problem populating Name, Format, and Desc using
    the Add method. However, later in the code I want to
    search for a particular Name and insert values in Type,
    Len, BegPos, EndPos.

    This is the code I've tried:

    For Each structVarInfo In arrVarInfo
    If structVarInfo.N ame = strTemp.Substri ng(10, 8) Then
    With structVarInfo
    .BegPos = strTemp.Substri ng(5, 4)
    If strTemp.Chars(1 9) = "$" Then
    .Type = "A"
    Else
    .Type = "N"
    .Len = strTemp.Chars(1 9)
    .EndPos = CStr(CInt(strTe mp.Substring(5,
    4)) + CInt(CStr(strTe mp.Chars(19))))
    End If
    End With
    End If
    Next

    What am I missing? Any help ASAP would be greatly
    appreciated. Thanks.


Working...