I have a datagridview which gets filled with data returned from a linq query. If the query returns no results I want to display a messagebox. Is there a way of checking to s
The DGV.Rows.Count method of checking if DGV is empty does not work if the option AllowUserToAddRows is set to true.
DGV.Rows.Count
AllowUserToAddRows
You have to disable AllowUserToAddRows = false then check for empty like this:
AllowUserToAddRows = false
if (dataGridView1.Rows != null && dataGridView1.Rows.Count != 0)