lasadsouka
-
3 avril 2013 à 14:30
ucfoutu
Messages postés18038Date d'inscriptionlundi 7 décembre 2009StatutModérateurDernière intervention11 avril 2018
-
3 avril 2013 à 16:19
j'ai un programme en vb 6.0 j'ai ais le code d'autentification mais quand j'execute mon programme la forme d'autentification ne s'affiche pas
If txtlogin.Text = "" Then
MsgBox "Entrer le login", vbInformation, "information"
txtlogin.SetFocus
Else
If txtpassword.Text = "" Then
MsgBox "Entrer le mot de passe", vbInformation, "information"
txtpassword.SetFocus
Else
If txtlogin.Text <> "gi2010" Then
MsgBox "login est incorect", vbInformation, "information"
txtpassword.SetFocus
Else
If txtlogin.Text = "gi2010" And txtpassword.Text <> "gl2010" Then
MsgBox "mot de passe incorrect", vbInformation, "information"
txtpassword.SetFocus
Else
If txtlogin.Text "gi2010" And txtpassword.Text "gl2010" Then
Form1.Show
authentification.Hide
Else
MsgBox "login ou mot de passe incorrect", vbInformation, "information"
txtlogin.SetFocus
End If
End If
End If
End If
End If
j'ais trois form: client.frm form2.frm form3.frm et autentification.frm
ucfoutu
Messages postés18038Date d'inscriptionlundi 7 décembre 2009StatutModérateurDernière intervention11 avril 2018211 3 avril 2013 à 14:59
Bonjour,
Ta discussion concerne vraiment le plus "élémentaire"
Tes else imbriqués finissent par se faire des croche-pieds.
Intéresse-toi à deux choses :
1) ElseIf
2) Exit sub
Trop élémentaire pour ne pas te laisser travailler un peu tout seul sur un tel point.
________________________
Réponse exacte ? => "REPONSE ACCEPTEE" facilitera les recherches.
Pas d'aide en ligne installée ? => ne comptez pas sur moi pour simplement répéter son contenu. Je n'interviendrai que si nécessité de la compléter.
ucfoutu
Messages postés18038Date d'inscriptionlundi 7 décembre 2009StatutModérateurDernière intervention11 avril 2018211 3 avril 2013 à 16:19
Enfin quoi !
Croche-pieds, ai-je dit ? ===>> regarde les commentaires que j'ai ajoutés à ton propre code :
If txtlogin.Text = "" Then
MsgBox "Entrer le login", vbInformation, "information"
txtlogin.SetFocus
Else ' donc textlogin.text <> ""
If txtpassword.Text = "" Then ' donc ne risque même pas de rentrer pas dans cette condition
MsgBox "Entrer le mot de passe", vbInformation, "information"
txtpassword.SetFocus
Else ' donc textlogin.text <> "" et txtpassword.text <> ""
If txtlogin.Text <> "gi2010" Then
MsgBox "login est incorect", vbInformation, "information"
txtpassword.SetFocus
Else ' donc textlogin.text <> "" et txtpassword.text <> "" et textlogin.text = "gi2010"
If txtlogin.Text = "gi2010" And txtpassword.Text <> "gl2010" Then ' donc
MsgBox "mot de passe incorrect", vbInformation, "information"
txtpassword.SetFocus
Else
If txtlogin.Text "gi2010" And txtpassword.Text "gl2010" Then ' ne passera donc pas par cette condition
Form2.Show
authentification.Hide
Else
MsgBox "login ou mot de passe incorrect", vbInformation, "information" ' ===>> et donc , hein ===>
txtlogin.SetFocus
End If
End If
End If
End If
End If
Question de logique, non ? (avant même de parler syntaxe. Juste de logique).
________________________
Réponse exacte ? => "REPONSE ACCEPTEE" facilitera les recherches.
Pas d'aide en ligne installée ? => ne comptez pas sur moi pour simplement répéter son contenu. Je n'interviendrai que si nécessité de la compléter.