private void FormKlasifikasiSurat_Load(object sender, EventArgs e) { JenisSurat jenis_surat = new JenisSurat(); setDataTable(jenis_surat.getAllJenisSurat()); //comboBoxJenisSurat.SelectedIndex = 0; loadComboBox(); }
private void buttonEditJenisSurat_Click(object sender, EventArgs e) { JenisSurat jenis_surat = new JenisSurat(); jenis_surat.id_jenis = id_jenis; jenis_surat.nama_jenis = textBoxEditJenisSurat.Text; jenis_surat.editJenisSurat(); frm1.setDataTable(jenis_surat.getAllJenisSurat()); frm1.loadComboBox(); }
private void buttonTambah_Click(object sender, EventArgs e) { JenisSurat j = new JenisSurat(); j.nama_jenis = textBoxJenis.Text; j.tambahJenisSurat(); frm1.setDataTable(j.getAllJenisSurat()); frm1.loadComboBox(); }
public void loadComboBox() { JenisSurat jenis_surat = new JenisSurat(); DataTable tabel = new DataTable(); tabel.Load(jenis_surat.getAllJenisSurat()); List <string> jenis = new List <string>(); comboBoxJenisSurat.Items.Clear(); for (int i = 0; i < tabel.Rows.Count; i++) { comboBoxJenisSurat.Items.Add(tabel.Rows[i][1].ToString()); } }
private void buttonHapusJenisSurat_Click(object sender, EventArgs e) { JenisSurat jenis_surat = new JenisSurat(); string title = "Konfirmasi Penghapusan Data"; string konten = "Apakah Anda yakin ingin menghapus data?"; DialogResult result = MessageBox.Show(konten, title, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == System.Windows.Forms.DialogResult.Yes) { jenis_surat.hapusJenisSurat(id_jenis); setDataTable(jenis_surat.getAllJenisSurat()); loadComboBox(); } }