Busqueda de un string de cualquier columna dentro de un datagridview

PHOTO EMBED

Sun Jan 07 2024 03:53:34 GMT+0000 (Coordinated Universal Time)

Saved by @javicinhio #cs

private void Find(string value)
{
  if (string.IsNullOrEmpty(value)) return;

  foreach (DataGridViewRow Row in Flex.Grid.Rows)
  {
    String strFila = Row.Index.ToString();
    foreach (DataGridViewCell cell in Row.Cells)
    {
      string Valor = Convert.ToString(cell.Value);

      if (Valor.ToLower().Trim().Contains(value.ToLower().Trim()))
      {
        Flex.Grid.CurrentCell = Flex.Grid.Rows[Convert.ToInt32(strFila)].Cells[0];
        Flex.Grid.Rows[Convert.ToInt32(strFila)].Selected = true;
        Flex.Grid.Select();
      }
    }
  }
}
content_copyCOPY