private void btnProcuraPaciente_Click(object sender, EventArgs e) { Parametros.Form = "Paciente"; Parametros.Valor = ""; bool open = false; foreach (Form form in Application.OpenForms) { // Verifica se o form esta aberto if (form.Name == "PesquisaPaciente") { if (form is PesquisaPaciente) { form.BringToFront(); open = true; } } } if (!open) { Form tela = new PesquisaPaciente(); tela.ShowDialog(); if (txtcodigo.Text.Trim() != "") { BuscaPaciente(int.Parse(txtcodigo.Text)); } } }
private void btnBuscaPaciente_Click(object sender, EventArgs e) { Parametros.Form = "Processo"; Parametros.Valor = ""; bool open = false; foreach (Form form in Application.OpenForms) { // Verifica se o form esta aberto if (form.Name == "PesquisaPaciente") { if (form is PesquisaPaciente) { form.BringToFront(); open = true; } } } if (!open) { Form tela = new PesquisaPaciente(); tela.ShowDialog(); RetornoPesquisaPaciente(); } }
public void AbrePesquisaPaciente() { bool open = false; foreach (Form form in this.MdiChildren) { if (form is PesquisaPaciente ) { form.BringToFront(); open = true; } } if (!open) { Form tela = new PesquisaPaciente(); tela.MdiParent = this; tela.Show(); } }