private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
try
{
if (e.RowIndex < 0)
return;
string valore =
dataGridView1.Rows[e.RowIndex].Cells["Nome"].Value?.ToString();
if (string.IsNullOrEmpty(valore))
return;
dataGridView1.ClearSelection();
foreach (DataGridViewRow riga in
dataGridView1.Rows)
{
if (riga.IsNewRow)
continue;
string ValoreRiga =
riga.Cells["Nome"].Value?.ToString();
if (!string.IsNullOrEmpty(ValoreRiga)
&& ValoreRiga == valore
)
{
riga.Selected
= true;
}
}
}
catch (Exception ex)
{
MessageBox.Show("Errore " +
ex.Message);
}
}
Nessun commento:
Posta un commento