!ss
do not compare an string with empty string if you want to check it is empty, it's bad practice
and your code can be simplifieed
and if you want to stop the loop, write break;
public bool TextBoxesAreEmpty(Control parent){ foreach (Control child in parent.Controls) { if(child is TextBox textbox && textbox.Text?.Length != 0){ MessageBox.Show(bla bla bla); return false; } } return true; }
Обсуждают сегодня