Пример #1
0
        private void txtBuscar_TextChanged(object sender, EventArgs e)
        {
            //showall();
            DTGV.ClearSelection();
            DTGV.CurrentCell = null;
            string busqueda = txtBuscar.Text.ToLower();

            if (txtBuscar.Text != "")
            {
                foreach (DataGridViewRow a in DTGV.Rows)
                {
                    string value = a.Cells[CampoBusqueda].Value.ToString().ToLower();

                    if (value.Contains(busqueda))
                    {
                        a.Visible = true;
                    }
                    else
                    {
                        a.Visible = false;
                    }
                }
            }
            else
            {
                for (int a = 0; a < DTGV.Rows.Count; a++)
                {
                    DTGV.Rows[a].Visible = true;
                }
            }
        }