Créer une condition if sur une valeur de textbox
B'jour!
J'essaye de créer une condition "if" qui affiche un certain texte dans un label si le champ Nom est vide...
J'ai fait quelque chose mais ça ne fonctionne pas. Je pense que je ne suis pas très loin de la vérité mais je n'y parviens pas!
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| if (textboxNom.getText() != null) {
String numeroadherent = textboxNumeroAdherent.getText();
String nom = textboxNom.getText();
String prenom = textboxPrenom.getText();
String adressePostale = textboxAdressePostale.getText();
String codePostal = textboxCodePostal.getText();
String ville = textboxVille.getText();
String dateExpir = textboxDateExpir.getText();
String password = textboxPassword.getText();
String creditRestant = textboxCreditRestant.getText();
String dateNaissance = textboxDateNaiss.getText();
Mapping.sauvegarderDonneesAdherents(nom, prenom, adressePostale, codePostal, ville, dateExpir, password, creditRestant, dateNaissance);
labelAherentAjoute.setText("Adhérent ajouté"); }
else labelAherentAjoute.setText("Nan ben non! Remplissez le champs Nom!"); |
Merci de votre aide!
David