|
-
Jan 19th, 2002, 10:17 PM
#1
Thread Starter
New Member
quick qustion
how do u pass a variable by adress to a function?
-
Jan 19th, 2002, 10:30 PM
#2
Junior Member
By default variables are passed by reference. You can also include the ByRef keyword in the function template.
put a button and a textbox in a form.
In declaration:
private x as integer
private function getvar( ByRef t as integer) as integer
dim hold as integer
hold=t
t=50
getvar=hold
end function
Command1_click()
dim a as integer
x=10
a=getvar(x)
Text1.text="xold=" & a & " " & "xnew=" & x
end sub
-
Jan 19th, 2002, 10:32 PM
#3
Um, not exactly sure what you mean. In VB you can pass values two ways, ByVal or ByRef. I'm thinking you want to pass ByRef. For ex;
Sub Foo(ByRef varSomeVar As Variant)
Variables passed ByRef can be modified the the routine you're passing them to (which I guess would mean you are passing by memory address).
VB passes ByRef by default but you can specify it to be explicit.
Paul
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
|