private void Segment5Student_Activated(object sender, EventArgs e) { StudentClass.AllStudents(this.dataGridView2); if (StudentClass.name != "" && StudentClass.dob != "" && StudentClass.gpa != null && StudentClass.active != null) { object[] row = new object[] { StudentClass.name, StudentClass.dob, StudentClass.gpa, StudentClass.active }; dataGridView1.Rows.Add(row); } }
private void button1_Click(object sender, EventArgs e) { for (int i = 1; i < dataGridView1.Rows.Count; i++) { StudentClass.StudentInsert(System.Convert.ToString(dataGridView1.Rows[i].Cells["StdName"].Value), System.Convert.ToString(dataGridView1.Rows[i].Cells["dob"].Value), System.Convert.ToDouble(dataGridView1.Rows[i].Cells["gpa"].Value), System.Convert.ToBoolean(dataGridView1.Rows[i].Cells["Act"].Value)); } StudentClass.name = ""; StudentClass.dob = ""; StudentClass.gpa = 0; StudentClass.active = false; StudentClass.AllStudents(this.dataGridView2); dataGridView1.Rows.Clear(); MessageBox.Show("All record/s have been updated to the database"); }