private void btnTambah_Click(object sender, EventArgs e) { if (txtID.Text.Trim().Length <= 0) { MessageBox.Show("ID Kosong!"); return; } if (txtNama.Text.Trim().Length <= 0) { MessageBox.Show("Nama Kosong!"); return; } if (txtHarga.Text.Trim().Length <= 0) { MessageBox.Show("Harga Kosong!"); return; } if (txtStok.Text.Trim().Length <= 0) { MessageBox.Show("Stok Kosong!"); return; } if (btnTambah.Text == "Tambah") { Barang std = new Barang(txtID.Text.Trim(), txtNama.Text.Trim(), txtHarga.Text.Trim(), txtStok.Text.Trim()); CRUDBarang.TmbhBarang(std); clrscr(); } if (btnTambah.Text == "Edit") { Barang std = new Barang(txtID.Text.Trim(), txtNama.Text.Trim(), txtHarga.Text.Trim(), txtStok.Text.Trim()); CRUDBarang.UpdateBarang(std, ID); clrscr(); } _parent.Display(); }