Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a Pointer to a variable in VB6

Status
Not open for further replies.

rguia

Programmer
Oct 19, 2001
6
0
0
US
Hi Guy

As you know, in C Language if you have this

int A;
int * pA;

You can assign to pA a pointer to Variable A doing this:

pA = &A;

How can i do that in VB6, Say that i have this

public sub myfunc(byref A as integer)

In this case "A" is a Pointer, and i want to copy this pointer in another variable AS A POINTER.


HOW CAN I DO THAT?


Millions of Thanks guys...!







 
Hi rguia,

could you provide more details about what you are trying to achieve in your program?
Maybe there is another way of doing it in VB? (|:)>
 
Well, it all depends on exactly what you want to do. There are no pointers in VB, so if you really need one, you'll have to find a work-around. If you tell us exactly what you need pointers for, maybe somebody can suggest one. In general, pointers in VB are a big pain, so unless you absolutely have to have them, it's probably a good idea to just do it another way.

Incedentally, I noticed you used integer types in your example. If you use pointers, you may want to keep in mind that Integers in VB are only 16 bits rather than 32, so you'll have to use Longs in VB to represent memory addresses.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top