private void grdStudent_RowEnter(object sender, DataGridViewCellEventArgs e) { if (m_editWithGridView) { if (m_NewRowIndex < grdStudent.NewRowIndex) { LinqLayer.AddStudent(grdStudent["First Name", m_NewRowIndex].Value.ToString(), grdStudent["Last Name", m_NewRowIndex].Value.ToString()); m_NewRowIndex = grdStudent.NewRowIndex; } } }
private void btnOK_Click(object sender, EventArgs e) { if (txtFirstName.Text.Trim() == "") { MessageBox.Show("You must enter a first name.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtLastName.Text.Trim() == "") { MessageBox.Show("You must enter a last name.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (m_AddEdit == StudentOperation.Add) { LinqLayer.AddStudent(txtFirstName.Text, txtLastName.Text); } else { LinqLayer.UpdateStudentName(m_Id, txtFirstName.Text, txtLastName.Text); } this.Close(); }