int i = 0;
string[] cellValues = null;
// Only take the first row for the search values
foreach (DataGridViewCell dataCell in DataGridView1.SelectedRows[0].Cells)
{
cellValues[i] = dataCell.Value.ToString();
i++;
}
string[] cellValues = new string[DataGridView1.SelectedRows[0].Cells.Count]
// Only take the first row for the search values
string[] cellValues = new string[DataGridView1.Rows[0].Cells.Count];
for (int i = 0; i < this.DataGridView1.Rows[0].Cells.Count; i++)
{
cellValues[i] = DataGridView1.Rows[0].Cells[i].Value.ToString();
}