دوستان عزیز کسی می تونه راهنمایی کنه مشکل این کد چیه؟
foreach (Control x in this.Controls) {
if (x is TextBox)
{
TextBox txb = (TextBox)x;
if ( txb.Text == "")
{
MessageBox.Show("خطا", "خطا");
}
else
{
MessageBox.Show("اوکی", "اوکی");
}
}
}
دوستان عزیز کسی می تونه راهنمایی کنه مشکل این کد چیه؟
foreach (Control x in this.Controls) {
if (x is TextBox)
{
TextBox txb = (TextBox)x;
if ( txb.Text == "")
{
MessageBox.Show("خطا", "خطا");
}
else
{
MessageBox.Show("اوکی", "اوکی");
}
}
}
private void button1_Click(object sender, EventArgs e) {
string err = "", fill = "";
foreach (Control x in Controls)
{
if (x is TextBox txb)
{
if (txb.Text == "")
{
err+=txb.Name+" " ;
}
else
{
fill = txb.Name + " ";
}
}
}
if (err.Length > 0)
MessageBox.Show(err + @" Is Empty Box");
if(fill.Length >0)
MessageBox.Show( fill + @"Is Fill Box");
}