We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

pointers???

timpeters
timpeters asked
on
Medium Priority
306 Views
Last Modified: 2010-05-03
does VB use an access object similar to pointers in other languages. If so, could I see some code.
Comment
Watch Question

tim,

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!).

Larry

Author

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.

Commented:
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).

Author

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.
tim,

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...

Larry

Author

Commented:
a code sample would be great.  I am reading info from a textfile and want to create a linked list.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
tim,

i just saw the grade you assigned to my answer.  was there something wrong with it?  drop me an e-mail: ldadams@hotmail.com
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.