private void BtnRecordToevoegen_Click(object sender, EventArgs e) { rowProductID = (int)DgvProducten.SelectedRows[0].Cells[0].Value; using (invulForm invulForm = new invulForm(this)) { invulForm.Text = "MySQL Databasebeheer - record toevoegen"; invulForm.RecordtitleLabel.Text = "record toevoegen"; if (invulForm.ShowDialog() == DialogResult.OK) { myTable.Rows.Add(new Object[] { rowProductID + 1, productNaam, stock, beschikbaar }); DgvProducten.Refresh(); MessageBox.Show("Waarden in datagridview gezet, druk op update om de database te synchronyseren", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void BtnRecordWijzigen_Click(object sender, EventArgs e) { rowProductID = (int)DgvProducten.SelectedRows[0].Cells[0].Value; using (invulForm invulForm = new invulForm(this)) { if (invulForm.ShowDialog() == DialogResult.OK) { myTable.Rows[rowProductID - 1]["productNaam"] = productNaam; myTable.Rows[rowProductID - 1]["productStock"] = stock; myTable.Rows[rowProductID - 1]["beschikbaar"] = beschikbaar; DgvProducten.Refresh(); MessageBox.Show("Waarden in datagridview gezet, druk op update om de database te synchronyseren", "INFO", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }