Quote:
Originally posted by hrdwareguy
If you know how many items you will need, you could put them into an array instead of a linked list.
|
You don't need to know the length of the array. You can Redim preserve the array to make it longer.
something like this:
Code:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim YourArray() As YourClass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'...
'your code here
'...
PutInArray(YourInstance)
'...
WriteToFile(YourArray)
End Sub
Sub PutInArray(ByVal sYourInstance As YourClass)
ReDim Preserve MyArray(YourArray.Length + 1)
YourArray(YourArray.Length) = sYourInstance
End Sub
Sub WriteToFile(ByRef sYourArray As YourClass)
Dim i As Integer
'your file open code here
For i = 0 To UBound(sYourArray)
'...
'your file write code here
'...
Next
'your file close code here
End Sub
End Class