byval
Publicado por julio (12 intervenciones) el 16/06/2007 01:37:56
No entiendo como funciona el pasaje de parametros, por lo que lei en la ayuda conviene pasar por valor, asi q lo prové con algo simple pero nunca modifica el valor de la variable desde donde llama y siempre lo modifica a donde lo llamo:
Private Sub Command1_Click()
Dim icant As Integer
icant = 10
porValor (icant)
MsgBox icant
End Sub
Private Sub Command2_Click()
Dim icant As Integer
icant = 12
porReferencia (icant)
MsgBox icant
End Sub
Sub porValor(ByVal icant As Integer)
icant = 1
End Sub
Sub porReferencia(ByRef icant As Integer)
icant = 1
End Sub
Private Sub Command1_Click()
Dim icant As Integer
icant = 10
porValor (icant)
MsgBox icant
End Sub
Private Sub Command2_Click()
Dim icant As Integer
icant = 12
porReferencia (icant)
MsgBox icant
End Sub
Sub porValor(ByVal icant As Integer)
icant = 1
End Sub
Sub porReferencia(ByRef icant As Integer)
icant = 1
End Sub
Valora esta pregunta


0