Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1273 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  [VB6] Pb If ... End If !!!!!!!!!!!!!!!!

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[VB6] Pb If ... End If !!!!!!!!!!!!!!!!

n°183745
GaLaCtus97​4
Posté le 26-07-2002 à 16:45:09  profilanswer
 

salut  
ou est l'erreur plizzz car il me lance bien le prg ensuite quand je demarre comman1 il me dit:
 
Compile error:
End if without block If
 
le code:
 
Private Sub Command1_Click()
    Image1.Visible = False
    Label1.Caption = Int(Rnd * 10)
    Label2.Caption = Int(Rnd * 10)
    Label3.Caption = Int(Rnd * 10)
        If (Label.Caption = 7) Or (Label2.Caption = 7) Or (Label3.Caption = 7) Then Label4.Caption = "Gagné!"
         
        End If
         
End Sub
 
Ou est l'erreur s'il vou plait?
 
merci

mood
Publicité
Posté le 26-07-2002 à 16:45:09  profilanswer
 

n°183774
mareek
Et de 3 \o/
Posté le 26-07-2002 à 16:58:30  profilanswer
 

si tu met une instruction sur la même ligne que le then, tu n'as pas besoin de "end if", VB considère que le if se termine à la fin de la ligne dans ce cas.


---------------
"I wonder if the internal negative pressure in self pumping toothpaste tubes is adjusted for different market altitudes." John Carmack
n°183787
GaLaCtus97​4
Posté le 26-07-2002 à 17:16:38  profilanswer
 

mareek a écrit a écrit :

 si tu met une instruction sur la même ligne que le then, tu n'as pas besoin de "end if", VB considère que le if se termine à la fin de la ligne dans ce cas.




 
ok merci beaucoup
je debute juste avec vb6 et je connaissai pas cette convetion
 

n°183789
GaLaCtus97​4
Posté le 26-07-2002 à 17:21:18  profilanswer
 

Par contre maintenant que j'ai enlever end if il me met un "object required" !!!
 
et il selectionne:  
If (Label.Caption = 7) Or (Label2.Caption = 7) Or (Label3.Caption = 7) Then
 
j'comprend pu  :??:

n°183791
Harkonnen
Modérateur
Un modo pour les bannir tous
Posté le 26-07-2002 à 17:24:31  profilanswer
 

essaie comme ça :
 
If (Label.Caption = 7) Or (Label2.Caption = 7) Or (Label3.Caption = 7) Then  
    Label4.Caption = "Gagné!"  
End If


---------------
J'ai un string dans l'array (Paris Hilton)
n°183792
mareek
Et de 3 \o/
Posté le 26-07-2002 à 17:24:35  profilanswer
 

galactus974 a écrit a écrit :

Par contre maintenant que j'ai enlever end if il me met un "object required" !!!
 
et il selectionne:  
If (Label.Caption = 7) Or (Label2.Caption = 7) Or (Label3.Caption = 7) Then
 
j'comprend pu  :??:  




 
c'est normal, ya rien sur ta ligne apres ton then


---------------
"I wonder if the internal negative pressure in self pumping toothpaste tubes is adjusted for different market altitudes." John Carmack
n°183799
GaLaCtus97​4
Posté le 26-07-2002 à 17:32:52  profilanswer
 

mareek a écrit a écrit :

 
 
c'est normal, ya rien sur ta ligne apres ton then




 
harkonnen g essayer et c la meme erreur
 
mareek la ligne que j'ai mis c vb qui l'a selectionner sinon c'etait comme dans le code que j'ai poster !
 
c vraiment bizarre
 :??:

n°183803
mareek
Et de 3 \o/
Posté le 26-07-2002 à 17:35:53  profilanswer
 

galactus974 a écrit a écrit :

 
 
harkonnen g essayer et c la meme erreur
 
mareek la ligne que j'ai mis c vb qui l'a selectionner sinon c'etait comme dans le code que j'ai poster !
 
c vraiment bizarre
 :??:  




recopie ton code via un copier coller sur le forum et met la ligne que VB te selectionne en gras.


---------------
"I wonder if the internal negative pressure in self pumping toothpaste tubes is adjusted for different market altitudes." John Carmack
n°183806
Harkonnen
Modérateur
Un modo pour les bannir tous
Posté le 26-07-2002 à 17:38:25  profilanswer
 

j'ai trouvé !!!
 

galactus974 a écrit a écrit :

Private Sub Command1_Click()
    Image1.Visible = False
    Label1.Caption = Int(Rnd * 10)
    Label2.Caption = Int(Rnd * 10)
    Label3.Caption = Int(Rnd * 10)
        If (Label.Caption = 7) Or (Label2.Caption = 7) Or (Label3.Caption = 7) Then Label4.Caption = "Gagné!"
         
        End If
         
End Sub



 
 
 :sol:


---------------
J'ai un string dans l'array (Paris Hilton)
n°183810
GaLaCtus97​4
Posté le 26-07-2002 à 17:42:49  profilanswer
 

Harkonnen a écrit a écrit :

j'ai trouvé !!!
 
 
 
 
 :sol:  




 
Merci  :jap:  
j'ai pas les yeux en face des trous
 
faut que j'arrete la jamaîcaine  :pt1cable:


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  [VB6] Pb If ... End If !!!!!!!!!!!!!!!!

 

Sujets relatifs
[VB6] pointeur sur tableau[VB6] Tracer des courbes
VB6 Comment creer un commandbutton par le code ?[VB] utiliser Grid32.ocx de VB5 dans VB6
appeler un macro Access avec VB6[ODBC/CRITERIA/ADO/VB6] pb ado entre Criteria et VB6
Erreur 10048 sous VB6[install VB6 ] - truc de ouffffffffffffffff
[VB6] Cherche bouquin particulierConnection a uneBDD access...[VB6]
Plus de sujets relatifs à : [VB6] Pb If ... End If !!!!!!!!!!!!!!!!


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR