private void UpdateMark() { this.Enabled = false; foreach (DataGridViewRow dataGridViewRow in dataGridView1.Rows) { string RollStudent = dataGridViewRow.Cells["RollStudentColumn"].Value + ""; for (int i = 0; i < dataGridViewRow.Cells.Count - 2; i++) { string RollType = dataGridView1.Columns[dataGridViewRow.Cells[i].ColumnIndex].DataPropertyName; object Mark = dataGridViewRow.Cells[i].Value; //MessageBox.Show(RollStudent + "\t" + RollType + "\t" + Mark); ManagementController.UpDateScore(RollStudent, RollType, Mark); } } this.Enabled = true; buttonSave.Enabled = false; MessageBox.Show("Update Success"); }