private void dgvInventory_CellClick(object sender, DataGridViewCellEventArgs e) { EditStockInId = Convert.ToInt32(dgvInventory.CurrentRow.Cells["StockInId"].Value); StockIn inventory = StockInService.GetInventoryById(EditStockInId); EditProductId = (int)inventory.ProductId; txtProductId.Text = inventory.ProductId.ToString(); txtBatch.Text = inventory.Batch; txtCount.Text = inventory.Count.ToString(); txtSubtotal.Text = inventory.Subtotal.ToString(); UserService userService = new UserService(); txtUser.Text = userService.GetUserById((int)inventory.UserId).Name; dtpInStockTime.Value = inventory.InStockTime; btnAdd.Enabled = false; btnUpdate.Enabled = true; }