Ejemplo n.º 1
0
        void AlertaDeFechas()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("Nombres", typeof(System.String));
            dt.Columns.Add("DNI", typeof(System.String));
            dt.Columns.Add("Telefono", typeof(System.String));
            dt.Columns.Add("Direccion", typeof(System.String));
            dt.Columns.Add("FechaBateria1", typeof(System.String));
            foreach (DataGridViewRow rowGrid in dgvGestantesSinBateria.Rows)
            {
                DataRow row = dt.NewRow();
                row["Nombres"]       = Convert.ToString(rowGrid.Cells["NombresBateria"].Value);
                row["DNI"]           = Convert.ToString(rowGrid.Cells["DNIBateria"].Value);
                row["Telefono"]      = Convert.ToString(rowGrid.Cells["TelefonoBateria"].Value);
                row["Direccion"]     = Convert.ToString(rowGrid.Cells["DireccionBateria"].Value);
                row["FechaBateria1"] = Convert.ToString(rowGrid.Cells["FechaBateria1"].Value);
                dt.Rows.Add(row);
            }
            //dt.DefaultView.RowFilter = ("Contact='" + cbFiltrar.Text + "'");
            dt.DefaultView.RowFilter = ("FechaBateria1 <='" + FechaActual.ToShortDateString() + "'");
            dataGridView1.DataSource = dt.DefaultView;
        }