Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 10-19-2003, 10:32 AM   #1 (permalink)
Junkie
 
Location: RI
[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.
Fallon is offline  
Old 10-20-2003, 02:22 AM   #2 (permalink)
"Officer, I was in fear for my life"
 
hrdwareguy's Avatar
 
Location: Oklahoma City
If you know how many items you will need, you could put them into an array instead of a linked list.
__________________
Gun Control is hitting what you aim at

Aim for the TFP, Donate Today
hrdwareguy is offline  
Old 10-20-2003, 06:16 AM   #3 (permalink)
Crazy
 
Location: Belgium
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
T.U.B. is offline  
Old 10-20-2003, 07:24 AM   #4 (permalink)
Junkie
 
Location: RI
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.
Fallon is offline  
 

Tags
linked, list, question


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 10:59 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76