Exemplo n.º 1
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            string fecha;

            if (dtpFechaGanancias.Value.Date == DateTime.Today.Date)
            {
                fecha = "";
            }
            else
            {
                fecha = dtpFechaGanancias.Value.Date.ToString("yyyy-MM-dd");
            }
            try
            {
                dgvGanancias.DataSource = GananciasDB.Buscar(fecha);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
 private void dtpFechaGanancias_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         string fecha;
         if (dtpFechaGanancias.Value.Date == DateTime.Today.Date)
         {
             fecha = "";
         }
         else
         {
             fecha = dtpFechaGanancias.Value.Date.ToString("yyyy-MM-dd");
         }
         try
         {
             dgvGanancias.DataSource = GananciasDB.Buscar(fecha);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }