|
-
May 17th, 2000, 03:21 AM
#1
Thread Starter
New Member
Quick question that should be easy for the experienced. I am trying to pass a variable's adderss as a parameter of a function. How do I write that in VB code. In C++ I would just put niftyfunciton(&variable) but the & in VB is for concatination. Whats the notation for passing a reference in VB?
-
May 17th, 2000, 03:33 AM
#2
VB passes everything by reference by default. You can add the ByRef keyword in the declaration if you want to be explicit.
John
-
May 17th, 2000, 03:38 AM
#3
Frenzied Member
I'm not entirely sure what you're trying to do.
you can pass a variable ByRef to a Function by specifying it in the Declaration
Code:
Private Sub AddOne(ByRef Number as Long)
Number = Number + 1
End Sub
will add one to what's stored in the variable passed to it.
If you want a Pointer to a Variable you can use
VarPtr(MyVar) which returns a long pointer to MyVar, I'ts pretty useless in VB Though unless you wan't to do some really wierd stuff with APIs that you could do without pointers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|