private void toolStripBtnDanePacjent_Click(object sender, EventArgs e) { bool IsOpen = false; foreach (Form f in Application.OpenForms) { if (f.Text == "Dane pacjenta") { IsOpen = true; f.Focus(); break; } } if (IsOpen == false) { if (dataGridViewPacjenci.RowCount != 0) { int row = dataGridViewPacjenci.CurrentCell.RowIndex; string id = dataGridViewPacjenci.Rows[row].Cells[5].Value.ToString(); this.Opacity = 0.5; DanePacjent f2 = new DanePacjent(id); f2.ShowDialog(); this.Opacity = 1; } else { MessageBox.Show("Musisz wybrać pacjenta!"); } } }
private void toolStripButtonInfo_Click(object sender, EventArgs e) { bool IsOpen = false; foreach (Form f in Application.OpenForms) { if (f.Text == "Dane pacjenta") { IsOpen = true; f.Focus(); break; } } if (IsOpen == false) { this.Opacity = 0.5; DanePacjent f2 = new DanePacjent(this.idpacjent); f2.ShowDialog(); this.Opacity = 1; } }