Hi Friends
I have a grid and I want check Rows of it that if its rows are empty a messagebox shows how i can do it? check all of grid's column's value?

private void button2_Click(object sender, EventArgs e)
    {
      foreach (DataGridViewRow row in dataGridView1.Rows)
      {
        if (row.IsNewRow)
          continue;

        bool hasData = false;
        for (int i1 = 0; i1 < dataGridView1.Columns.Count; i1++)
        {
          if (!string.IsNullOrEmpty(Convert.ToString((row.Cells[i1].Value == null ? string.Empty : row.Cells[i1].Value))))
            hasData = true;
        }
        if (!hasData)
        {
          row.ErrorText = "Empty data";
          MessageBox.Show("you have an empty row");
        }
      }
    }
commented: This could again become a valuable code snippet! +8