private void dgvInventory_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } if (e.ColumnIndex == 4) { DataGridViewRow row = dgvInventory.Rows[e.RowIndex]; itemForm itemForm = new itemForm((int)row.Cells[0].Value, (string)row.Cells[1].Value, (int)row.Cells[2].Value, (int)row.Cells[3].Value); itemForm.Show(); } else if (e.ColumnIndex == 5) { DataGridViewRow row = dgvInventory.Rows[e.RowIndex]; string itemID = row.Cells[0].Value.ToString(); if (MessageBox.Show("Hapus barang ini?", "POS", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { DBAccess.InsertQuery("delete from orders where itemid = " + itemID); DBAccess.InsertQuery("delete from item where id = " + itemID); POS_Activated(new object(), new EventArgs()); } } }
private void btnAddItemInventory_Click(object sender, EventArgs e) { itemForm itemForm = new itemForm(); itemForm.Show(); }