Dear friends.
I have a MDI parent form with several menu options, in which I have a Status Strip control, and I give as an example when opening a form of my patient file and when making a query I want to show in my status bar of the form MDI "Executing query ..." from my client form Customers.cs
my code in form MDI when selecting the Customers option
private void mnuConsultasClientes_Click(object sender, EventArgs e)
{
frmClientes frm = this.MdiChildren.OfType<frmClientes>().Where(x => x.Name == "frmClientes").FirstOrDefault();
if (frm == null)
{
sbEstado.Text = "Abriendo formulario Clientes..";
frmClientes frmClientes = new frmClientes();
frmClientes.MdiParent = this;
frmClientes.WindowState = FormWindowState.Maximized;
frmClientes.Show();
sbEstado.Text = "Listo";
}
else
{
frm.WindowState = FormWindowState.Maximized;
}
When making a client query for examples all those that start with VAS
My code in Consult button.
private void tsBuscar_Click(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();
errorProvider1.Clear();
if (txtBusqueda.Text.ToString().Trim()==String.Empty)
{
errorProvider1.SetError(txtBusqueda, "Ingrese un criterio de busqueda...");
return;
}
//MessageBox.Show(cboBuscarPor.SelectedIndex.ToString());
switch (cboBuscarPor.SelectedIndex)
{
case 0:
sb.Append(" AND CLI.CLI_NOMBRE LIKE '" + txtBusqueda.Text.ToString().Trim() + "%'");
break;
case 1:
sb.Append(" AND CLI.CLI_RUC LIKE '" + txtBusqueda.Text.ToString().Trim() + "%'");
break;
}
//dgvLista.AutoGenerateColumns = false;
dgvLista.DataSource = nCliente.GetListClientes(sb.ToString());
}
Thanks for your kind help.