private Label BosLabelGetir() { Label lblGelen = new Label(); FrmSalon salonForm = null; foreach (Form item in Application.OpenForms) { if (item.Text == "Fatih Özkır Salonu") { salonForm = (FrmSalon)item; } } if (salonForm != null) { foreach (Control lbl in salonForm.Controls) { if (lbl is Label) { if (lbl.Tag == "Bos") { lblGelen = (Label)lbl; } } } } return(lblGelen); }
private Button ButonuGetir() { Button btnGelen = new Button(); FrmSalon salonForm = null; foreach (Form item in Application.OpenForms) { if (item.Text == "Fatih Özkır Salonu") { salonForm = (FrmSalon)item; } } if (salonForm != null) { foreach (Control btn in salonForm.Koltuklar.Controls) { if (btn is Button) { if (btn.Text == koltukNo.ToString()) { btnGelen = (Button)btn; } } } } return(btnGelen); }