Erreur ByRef...comment faire

monsnow Messages postés 12 Date d'inscription vendredi 9 août 2002 Statut Membre Dernière intervention 10 juillet 2003 - 20 mai 2003 à 12:58
stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 - 20 mai 2003 à 13:07
slt tout le monde..
j'ai un petit soucis~
je fais donc appel a la solidarite...merci
voila

mon programme est du style

function f1(k as single)
...
end function

function f2(n as single)
f2=0
for k = 1 to n
f2=f2+ f1(k)
nextk
end function

...mais vb me dit qu'il y a une erreur ByRef lorsque je fais
f1(k) dans la boucle...

comment faire???
aidez moi~svp
merci et bonne journee

monsnow

1 réponse

stevebelgium Messages postés 180 Date d'inscription lundi 17 mars 2003 Statut Membre Dernière intervention 7 juin 2003 1
20 mai 2003 à 13:07
voila :

Private Sub Command1_Click()
MsgBox f2(2)
End Sub

Function f1(ByVal k As Single)
f1 = k * 2
End Function

Function f2(n As Single)

f2 = 0
For k = 1 To n
f2 = f2 + f1(k)
Next k
End Function
0
Rejoignez-nous