public void FormListBookType_Load(object sender, EventArgs e)
 {
     listOfTipeBuku = TipeBuku.BacaData("", "");
     comboBoxSearch.SelectedIndex = 0;
     if (listOfTipeBuku.Count > 0)
     {
         dataGridView1.DataSource = listOfTipeBuku;
     }
     else
     {
         dataGridView1.DataSource = null;
     }
 }
 private void textBoxId_TextChanged(object sender, EventArgs e)
 {
     if (textBoxId.Text.Length == textBoxId.MaxLength)
     {
         listOfTipeBuku = TipeBuku.BacaData("IdTipeBuku", textBoxId.Text);
         if (listOfTipeBuku.Count > 0)
         {
             textBoxJenisBuku.Text = listOfTipeBuku[0].JenisBuku;
             textBoxJenisBuku.Focus();
         }
         else
         {
             MessageBox.Show("Kode kategori tidak ditemukan", "Kesalahan");
             textBoxJenisBuku.Text = "";
             textBoxId.Text        = "";
             textBoxId.Focus();
         }
     }
 }
        private void textBoxSearch_TextChanged(object sender, EventArgs e)
        {
            if (comboBoxSearch.Text == "Id Tipe Buku")
            {
                listOfTipeBuku = TipeBuku.BacaData("idTipeBuku", textBoxSearch.Text);
            }
            else if (comboBoxSearch.Text == "Jenis Buku")
            {
                listOfTipeBuku = TipeBuku.BacaData("jenisBuku", textBoxSearch.Text);
            }

            if (listOfTipeBuku.Count > 0)
            {
                dataGridView1.DataSource = listOfTipeBuku;
            }
            else
            {
                dataGridView1.DataSource = null;
            }
        }
        private void FormDeleteOfBook_Load(object sender, EventArgs e)
        {
            textBoxId.MaxLength    = 5;
            textBoxJudul.MaxLength = 45;

            listOfTipeBuku = TipeBuku.BacaData("", "");
            comboBoxTipeBuku.DataSource    = listOfTipeBuku;
            comboBoxTipeBuku.DisplayMember = "JenisBuku";
            comboBoxTipeBuku.DropDownStyle = ComboBoxStyle.DropDownList;

            listOfPenerbit = Penerbit.BacaData("", "");
            comboBoxPenerbit.DataSource    = listOfPenerbit;
            comboBoxPenerbit.DisplayMember = "NamaPenerbit";
            comboBoxPenerbit.DropDownStyle = ComboBoxStyle.DropDownList;

            comboBoxPenerbit.Enabled = false;
            comboBoxTipeBuku.Enabled = false;
            textBoxHarga.Enabled     = false;
            textBoxHarga.Enabled     = false;
            textBoxJudul.Enabled     = false;
            textBoxStok.Enabled      = false;
        }
        private void FormChangeBook_Load(object sender, EventArgs e)
        {
            textBoxId.MaxLength    = 5;
            textBoxJudul.MaxLength = 45;

            listOfTipeBuku = TipeBuku.BacaData("", "");
            comboBoxTipeBuku.DataSource    = listOfTipeBuku;
            comboBoxTipeBuku.DisplayMember = "JenisBuku";
            comboBoxTipeBuku.DropDownStyle = ComboBoxStyle.DropDownList;

            listOfPenerbit = Penerbit.BacaData("", "");
            comboBoxPenerbit.DataSource    = listOfPenerbit;
            comboBoxPenerbit.DisplayMember = "NamaPenerbit";
            comboBoxPenerbit.DropDownStyle = ComboBoxStyle.DropDownList;

            textBoxJudul.Text = "";
            textBoxHarga.Text = "";
            textBoxStok.Text  = "";
            textBoxId.Text    = "";

            textBoxHarga.TextAlign = HorizontalAlignment.Right;
            textBoxStok.TextAlign  = HorizontalAlignment.Right;
        }