Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [VB] Linked List question (https://thetfp.com/tfp/tilted-technology/32301-vbulletin-linked-list-question.html)

Fallon 10-19-2003 10:32 AM

[VB] Linked List question
 
I doubt that's the correct wording for it. I'm used to C, not VB. Anyway, I'm trying to make multiple instances of a something so that I can easily edit them, then I want to write it to a file. My problem right now is, I don't know how to make a list like that or if it's possible. Thanks.

hrdwareguy 10-20-2003 02:22 AM

If you know how many items you will need, you could put them into an array instead of a linked list.

T.U.B. 10-20-2003 06:16 AM

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


Fallon 10-20-2003 07:24 AM

An example of the list that I'm using is:
Mob
char Name;
char longname;
char short;
int level;

and a bunch more after it. In all I think there are about 25 values that are needed.
There could be at least 1000 instances of each list.


All times are GMT -8. The time now is 04:51 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43