private void grid_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (grid.CurrentRow != null) { itemForm = new FormAddItem(this, itemType); getValues(); itemForm.medicine.Enabled = false; itemForm.equipment.Enabled = false; itemForm.ShowDialog(); } }
private void mbView_Click(object sender, EventArgs e) { if (grid.CurrentRow != null) { itemForm = new FormAddItem(this, itemType); getValues(); itemForm.ShowDialog(); } else { MetroMessageBox.Show(this.Parent.Parent, "No results found.", "EMPTY GRID", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridItemLibrary_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { int intType = 1; if (grid.CurrentRow.Cells[0].Value.ToString().Equals("Medicine")) { intType = 1; } else if (grid.CurrentRow.Cells[0].Value.ToString().Equals("Supply")) { intType = 2; } else if (grid.CurrentRow.Cells[0].Value.ToString().Equals("Equipment")) { intType = 3; } FormAddItem itemForm = new FormAddItem(this, intType); getValues(itemForm, intType); itemForm.ShowDialog(); }
private void getValues(FormAddItem itemForm, int itemType) { itemForm.choice = 1; if (itemType == 3) { itemForm.txtCode.Text = grid.CurrentRow.Cells[0].Value.ToString(); itemForm.txtGeneric_.Text = grid.CurrentRow.Cells[2].Value.ToString(); itemForm.txtName_.Text = grid.CurrentRow.Cells[3].Value.ToString(); itemForm.cbManufacturer_.SelectedIndex = itemForm.cbManufacturer_.Items.IndexOf(grid.CurrentRow.Cells[6].Value.ToString()); itemForm.txtMin_.Text = grid.CurrentRow.Cells[7].Value.ToString(); itemForm.txtMax_.Text = grid.CurrentRow.Cells[8].Value.ToString(); } else { itemForm.txtCode.Text = grid.CurrentRow.Cells[0].Value.ToString(); itemForm.txtGen.Text = grid.CurrentRow.Cells[2].Value.ToString(); itemForm.txtName.Text = grid.CurrentRow.Cells[3].Value.ToString(); itemForm.txtDosage.Text = grid.CurrentRow.Cells[4].Value.ToString(); itemForm.cbForm.SelectedIndex = itemForm.cbForm.Items.IndexOf(grid.CurrentRow.Cells[5].Value.ToString()); itemForm.cbManufacturer.SelectedIndex = itemForm.cbManufacturer.Items.IndexOf(grid.CurrentRow.Cells[6].Value.ToString()); itemForm.txtMin.Text = grid.CurrentRow.Cells[7].Value.ToString(); itemForm.txtMax.Text = grid.CurrentRow.Cells[8].Value.ToString(); } }
private void mbAdd_Click(object sender, EventArgs e) { itemForm = new FormAddItem(this, itemType); itemForm.choice = 0; itemForm.ShowDialog(); }