does VB use an access object similar to pointers in other languages. If so, could I see some code.
Who is Participating?
StapleheadConnect With a Mentor Commented:
ok, i didn't get a chance to jump into VB last night, so let me type some code at you here...

here's your class (use a variant to make it as reusable as possible; it's not wrong (but against the spirit of OOP) to use a more definite type):

Public Data as Variant
Public Next as CLinkList

you'll want to have two private data members in your class (CLinkList):

private llHead as CLinkList
private nbrElements as long

you'll want to have a method to return the first element; since you'll want other classes to be able to call it, make it a friend method (property):

friend property get head() as CLinkList
    set head = llHead
end property

you'll want to be able to add an element:

sub add (llData as variant)
    dim newNode as new CLinkList

    if isobject(vitem) then
        set newNode.Data = llData
        newNode.Data = llData
    end if

    set newNode.Next = llHead
    set llHead = newNode

    count = count + 1
end sub

ok, so there's the meat.  since you said you're familiar with pointers / C, i'm skipping some code... this code inserts at the head of the list; you could also insert at the tail (with a "pointer" to the current tail, or by traversing the list).  deleting from the head is also straightforward (by making llHead refer to its current Next property).  you'll also want to be able to search through the list (by walking through the Next's).  like i said, i'm assuming that you're familiar with that kind of thing, so the code above gives you the flavor of the implementation.  since i'm fresh from playing around with java, i'll also add that in the OO world, there's the opinion that you should have a standard way of moving through a list of things, regardless of how that list of things is implemented (list, stack, etc).  usually, they're called iterators, or enumerations, or some such.  you may want to look at defining a class that knows how to walk through your linked list; of course, that code could also be part of your class, but that sort of thing is usually frowned upon by OO gurus.

i'm pretty sure that "Hardcore VB" has a section on linked lists, stacks, vectors, and collections.  (it's a good book: if it's not on your bookshelf, i recommend it...)

is that what you were looking for?

you *can* access pointers to objects by using the (officially) undocumented varptr() call, but that isn't really a kosher vb way to do things.  in addition, when creating objects, your variables are really references, which means that behind the scenes, they're treated like pointers, but to your view, they're data, not pointers to data.

what is it that you're trying to do?  although there are instances when you need to use pointers to data (some API calls, etc), there's "usually" a way to do things in VB without resorting to pointer usage (anathema to a guy who cut his teeth on C, but there: i've said it!).

timpetersAuthor Commented:
I am reading in data and I want a way to store  this information at run time, but I have no way of knowing the length of the file I am reading.  Using a Redim statement will not accomplish what I am trying to do.  I am trying to avoid using arrays.
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Hooray Staplehead, I knew you could do it.  :)

Seriously, though, as Staplehead noted, pointers to objects are actually references.  Sort of like pointers to pointers.

There may be a third party control which will actually give you a true pointer to an object.  I'm not sure, but SpyWorks by Desaware (www.desaware.com) might do it.  You also might check out Stamina from MicroDexterity (www.microdexterity.com).
timpetersAuthor Commented:
I understand completely what pointers are.  I have just never seen them used in VB.  I am looking for some code that uses them.  I just want to use them to keep a linked list of text strings.

on the other hand, it seems that you're asking about pointers because you're considering building a linked list.

this can be done in vb pretty straightforwardly.  instead of your "next" element being a pointer to your base type, it can be (implicitly) a reference to your base type.  when creating a new link, just set the next = some other element in your list.

vb classes work well here.

if this is what you're trying to do, and need a code sample, let me know...

timpetersAuthor Commented:
a code sample would be great.  I am reading info from a textfile and want to create a linked list.

i just saw the grade you assigned to my answer.  was there something wrong with it?  drop me an e-mail: ldadams@hotmail.com
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.