Class initialize vb6

Fermé
carterjr Messages postés 20 Date d'inscription mercredi 31 octobre 2012 Statut Membre Dernière intervention 28 novembre 2015 - Modifié par carterjr le 16/11/2015 à 07:37
f894009 Messages postés 17200 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 11 septembre 2024 - 16 nov. 2015 à 10:50
bonjour!

pourquoi je recois toujours le msgbox erreur dans la class_initialize tandisque dans la sub log msgbox welcome ?


Dim a As Variant
Dim b As Variant

Public Sub log(a As Variant, b As Variant)
a = a
b = b
If a = "echo" And b = "echo" Then
MsgBox "welcome "
Else
MsgBox "error"
End If
End Sub

Private Sub Class_Initialize()
log a, b
End Sub



Private Sub Command1_Click()
Dim x As Class1
Set x = New Class1
x.log "echo", "echo"
End Sub
A voir également:

1 réponse

f894009 Messages postés 17200 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 11 septembre 2024 1 708
16 nov. 2015 à 10:50
Bonjour,


Set x = New Class1
provoque l'initialisation de la class et dans
Private Sub Class_Initialize()
il y a
log a,b
qui donne lieu a l'affichage de "error" et ensuite
x.log "echo", "echo"
vous donne l'affichage de "welcom"
0