|
-
Jan 12th, 2000, 04:25 AM
#1
Thread Starter
Member
So What is ByVal?
I'm just beginer in VB so i know practicaly nothing in it.
By the way thanks for everyone who answered my previous posts and who will answer this one.
------------------
-casparas
novice programer
[email protected]
-
Jan 12th, 2000, 04:38 AM
#2
ByVal means To Pass By Value, meaning you you pass something ByVal you are passing the Value of the Variable not a Pointer to the Variable itself, ie.
Code:
Private Sub Command1_Click()
Dim iTemp As Integer
iTemp = 2
Call Add2(iTemp)
Debug.Print iTemp
End Sub
Private Sub Add2(ByVal X As Integer)
X = X + 2
End Sub
Calling this code would always Print "2" in the Debug Window.
If you modify the Add2 Routine to be ByReference, it would Print "4".
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jan 12th, 2000, 04:56 AM
#3
New Member
One other thing to note. ByRef is the VB default way of passing variable. If you don't specify, it will be ByRef.
Roger Eagans
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
|