Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21096

Can't get ByRef to work in VB 6.0

$
0
0
I am trying to run this very simple application ( a form and one button ):


Public Sub Modify(ByRef b As Integer)
b = 167
MsgBox (b)
End Sub


Private Sub Command1_Click()
Dim a As Integer
a = 12
Modify (a)
MsgBox (a)
End Sub



I expect "a" to get modified after calling Modify and for it to output 167, 167.

Instead I am getting 167, 12 (No modification occurs). Do you have any idea why this is happening.

Viewing all articles
Browse latest Browse all 21096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>