private void StudentDataGridView_CurrentCellDirtyStateChanged(object sender, EventArgs e) { if (StudentDataGridView.IsCurrentCellDirty) { StudentDataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit); } }
private void btnRegisteredStudents_Click(object sender, EventArgs e) { using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("SELECT * FROM dbo.Student", con)) { cmd.CommandType = CommandType.Text; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { using (DataTable dt = new DataTable()) { sda.Fill(dt); StudentDataGridView.DataSource = dt; } } } } //ListOfAddedStudentsForm r = new ListOfAddedStudentsForm(); //this.Hide(); //r.Show(); lblFirstName.Hide(); txtFirstName.Hide(); lblLastName.Hide(); txtLastName.Hide(); lblContact.Hide(); txtContact.Hide(); lblEmail.Hide(); txtEmail.Hide(); lblRegistrationNumber.Hide(); txtRegistrationNumber.Hide(); lblStatus.Hide(); txtStatus.Hide(); btnRegister.Hide(); StudentDataGridView.Show(); }
private void btnAddStudent_Click_1(object sender, EventArgs e) { lblFirstName.Show(); txtFirstName.Show(); lblLastName.Show(); txtLastName.Show(); lblContact.Show(); txtContact.Show(); lblEmail.Show(); txtEmail.Show(); lblRegistrationNumber.Show(); txtRegistrationNumber.Show(); lblStatus.Show(); txtStatus.Show(); btnRegister.Show(); StudentDataGridView.Hide(); }
private void AddStudentMain_Click(object sender, EventArgs e) { using (var addStudentForm = new AddStudentForm()) { var dialogresult = addStudentForm.ShowDialog(); if (DialogResult.OK == dialogresult) { using (AanwezigheidsContext ctx = new AanwezigheidsContext()) { ctx.Deelnemers.Add(new Deelnemer() { Naam = addStudentForm.naam, Woonplaats = addStudentForm.Adres, Geboortedatum = addStudentForm.Geboortedatum }); ctx.SaveChanges(); StudentDataGridView.Update(); StudentDataGridView.Refresh(); } } } }
private void FormAddStudent_Load(object sender, EventArgs e) { StudentDataGridView.Hide(); }