private void DgvMedicine_CellClick(object sender, DataGridViewCellEventArgs e) { btnUpdate.Visible = true; btnCreate.Visible = false; int id = (int)dgvMedicine.Rows[e.RowIndex].Cells[0].Value; ID = id; Medicine medicine = _pharmacy.GetMedicine(id); txtMedicine.Text = medicine.Name; txtPrice.Text = medicine.Price; }