title: C# Dynamically add DataGridViewRow malfunction
body: <p>I have a program that will add rows dynamically in certain conditions, I've tried implement the function in this way:</p>
  
  <pre><code>if (student.UUID == AppliedStudent)
  {
      using (DataGridViewRow row = new DataGridViewRow())
      {
          row.SetValues(new object[] { lesson.Name, Course.Course_Name, lesson.Level, lesson.Time, Teacher.C_Name, lesson.Price, Classroom.Classroom_Name });
          row.DefaultCellStyle.BackColor = Color.LightGreen;
          row.DefaultCellStyle.SelectionBackColor = Color.SkyBlue;
          dataGridView1.Rows.Add(row);
      }
  }
  </code></pre>
  
  <p>With this code, it can add in rows indeed however they are all empty, all those rows has no data in it. (It has been confirmed that <code>lesson</code>, <code>course</code> and <code>Teacher</code> aren't <code>null</code>.) Can anyone help? Thanks!</p>