private void btnTambah_Click(object sender, EventArgs e) { Tambahdata form = new Tambahdata(true); if (form.Run(form)) { LoadData(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (this.dgvData.SelectedRows.Count > 0) { DataGridViewRow row = this.dgvData.SelectedRows[0]; people addrBook = new people(); addrBook.Nama = row.Cells[0].Value.ToString(); addrBook.Alamat = row.Cells[1].Value.ToString(); addrBook.Kota = row.Cells[2].Value.ToString(); addrBook.NoHP = row.Cells[3].Value.ToString(); addrBook.TanggalLahir = Convert.ToDateTime(row.Cells[4].Value).Date; addrBook.Email = row.Cells[5].Value.ToString(); Tambahdata form = new Tambahdata(false, addrBook); if (form.Run(form)) { LoadData(); } } }