On Dec 02, 1995 19:50:59 in article <Somebody Please HELP!!>,
Quote:
>Can anybody help me here? This may be a stupid question, but does
>anyone know how to represent data in VB as links and nodes? Having a
>node represent any piece of information and having a link that points
>to another node. I know this is simple C stuff, but what about in VB?
>Any ideas?
>Thanks in advance.
>Dave
Try this:
Public Type NodeElement
Info As String (or other info type)
Link As Integer
End Type
Dim BunchOfNodes[A Big Number] as NodeElement
When you create a new node, stuff the info into the next available slot in
BunchOfNodes. When you need to set a link, set the .link component of the
node to the index of the node you need to point to...
Unfortunately, it's a little hard to "forget" that the elements are all in
an array, and there's no dynamic re-allocation. (Actually, you can fake
dynamic re-allocation with 2 arrays and the redim statement, but unless
it's absolutely necessary, it's more trouble than it's worth.)
You _can_ make it work this way... I did a project like this a while ago (a
long while - it was on a Commodore 128!), and it did work!
good luck,
gordo