Hide all TEXTBOXES and LABELS together for Windows Form App

 private void Form1_Load(object sender, EventArgs e) {
//for hide all textboxes
for (int i = 0; i < this.Controls.Count; i++)
{
   if (this.Controls[i].GetType().ToString() == "System.Windows.Forms.TextBox")
       this.Controls[i].Visible = false;
}
//for hide all labels
for (int i = 0; i < this.Controls.Count; i++)
{
   if (this.Controls[i].GetType().ToString() == "System.Windows.Forms.Label")
       this.Controls[i].Visible = false;
}
}

Yorumlar

Popüler Yayınlar