private void FormTambahSPK_Load(object sender, EventArgs e) { frmDaftar = (FormDaftarSPK)this.Owner; try { string codebaru; string hasilgen = Spk.GenerateCode(out codebaru); if (hasilgen == "1") { textBoxNoSPK.Text = codebaru; textBoxNoSPK.Enabled = false; } else { MessageBox.Show("Gagal melakukan generate code. Pesan kesalahan: " + hasilgen); } ListDatapeg.Clear(); listdatabarang.Clear(); string hasilbaca2 = OrderPenjualan.BacaData("", "", listorderpenjualan); if (hasilbaca2 == "1") { comboBox1.Items.Clear(); for (int i = 0; i < listorderpenjualan.Count; i++) { comboBox1.Items.Add(listorderpenjualan[i].NoOrder); } } string hasilBaca3 = Pekerja.BacaData("", "", ListDatapeg); if (hasilBaca3 == "1") { comboBoxPekerja.Items.Clear(); for (int i = 0; i < ListDatapeg.Count; i++) { comboBoxPekerja.Items.Add(ListDatapeg[i].IdPekerja + " . " + ListDatapeg[i].Nama); } } else { MessageBox.Show("Data Pekerja gagal ditampilkan. Pesan kesalahan: " + hasilBaca3); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void sPKToolStripMenuItem1_Click(object sender, EventArgs e) { Form form = Application.OpenForms["FormDaftarSPK"]; if (form == null) { FormDaftarSPK frm = new FormDaftarSPK(); frm.Owner = this; frm.Show(); } else { form.Show(); form.BringToFront(); } }