private void btnHapusBarang_Click(object sender, EventArgs e) { Barang barang = new Barang(); barang.setId(Convert.ToInt32(txtIdBarang.Text)); Console.WriteLine(barang.getId()); barang.Delete(); foreach (Control ctrl in mtpBarang.Controls) { if (ctrl is TextBox) { ctrl.Text = ""; } } MessageBox.Show("Barang berhasil dihapus."); }