foreach (Control ctrlButton in this.Controls) { if (ctrlButton is TextBox && ctrlButton.Visible == true) { if(String.isNullOrEmpty(ctrButton as TextBox).Text) { MessageBox.Show(String.Format("Error on {0}",ctrButton.Name)); break;//sortie pas propre sur le premier controle en erreur } } }
Quelques mots de remerciements seront grandement appréciés. Ajouter un commentaire
115 internautes nous ont dit merci ce mois-ci
foreach (Control ctrlButton in this.Controls) { if (ctrlButton is TextBox && ctrlButton.Visible == true) { if (String.IsNullOrEmpty((ctrlButton as TextBox).Text)) { MessageBox.Show(String.Format("Error on {0}", ctrlButton.Name)); break;//sortie pas propre sur le premier controle en erreur } } }
foreach (Control ctrlButton in groupBox1.Controls) { if (ctrlButton is TextBox && ctrlButton.Visible == true) { if (String.IsNullOrEmpty((ctrlButton as TextBox).Text)) { MessageBox.Show(String.Format("Error on {0}", ctrlButton.Name)); break;//sortie pas propre sur le premier controle en erreur } } }
foreach (Control ctrlButton in this.Controls) { if (ctrlButton is TextBox && ctrlButton.Visible == true) { if(String.isNullOrEmpty(ctrButton as TextBox).Text) { MessageBox.Show(String.Format("Error on {0}",ctrButton.Name)); break;//sortie pas propre sur le premier controle en erreur } } if (ctrlButton is GroupBox && ctrlButton.Visible == true) { foreach (Control ctrlButton2 in ctrlButton.Controls) { if (ctrlButton2 is TextBox && ctrlButton2.Visible == true) { if (String.IsNullOrEmpty((ctrlButton2 as TextBox).Text)) { MessageBox.Show(String.Format("Error on {0}", ctrlButton2.Name)); break;//sortie pas propre sur le premier controle en erreur } } } } }
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.