Structure trouble

Craig

Well-known member
Joined
Oct 15, 2005
Messages
110
Location
United Kingdom
Programming Experience
Beginner
Hi, I am using a structure to create 'records' which is read/written to a text file, all this works fine.

The problem i am having is that if the user removes a customer from the structure, I will need it to re-use that customers ID number (should be unique) for the new one added.

I'm sorry if this isn't the best of explanations. But here is what I attempted but didnt work:
VB.NET:
    Structure Record
 Public Id, TitleValue, [COLOR=Blue]'[/COLOR][COLOR=Blue]Shortened'[/COLOR], Submitted As String
    End Structure
    Dim Records As New ArrayList
    Dim r As Record

VB.NET:
            For Each r.Id In Records 
                Dim intX As Integer = 1001
                If CInt(r.Id) <> intX Then
                    Tb_ID.Text = intX
                    intX = 1001
                End If
                intX += 1
            Next
What this should be doing is checking each ID (first ID = 1001) and then comparing it with 1000+intX, if they are not equal, set the ID textbox to that value..

The error I get is:

An unhandled exception of type 'System.InvalidCastException' occurred in microsoft.visualbasic.dll

Additional information: Cast from type 'Record' to type 'String' is not valid.


Thanks
 
For Each r As Record In Records
 
Back
Top