예제 #1
0
        private void tabelstok_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                formm.clrscr();

                formm.ID    = tabelstok.Rows[e.RowIndex].Cells[2].Value.ToString();
                formm.NAMA  = tabelstok.Rows[e.RowIndex].Cells[3].Value.ToString();
                formm.HARGA = tabelstok.Rows[e.RowIndex].Cells[4].Value.ToString();
                formm.STOK  = tabelstok.Rows[e.RowIndex].Cells[5].Value.ToString();
                formm.UpdateBarang();
                formm.ShowDialog();

                return;
            }
            if (e.ColumnIndex == 1)
            {
                if (MessageBox.Show("Yakin ingin dihapus?", "Information", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    CRUDBarang.DeleteBarang(tabelstok.Rows[e.RowIndex].Cells[2].Value.ToString());
                    Display();
                }
                return;
            }
        }