private void dataGridItems_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { ItemUpdateForm itemUpdate = new ItemUpdateForm(); int rowIndex = e.RowIndex; itemUpdate.checkInstance.txtBoxItemID.Text = this.dataGridItems.Rows[rowIndex].Cells[0].Value.ToString(); itemUpdate.checkInstance.txtBoxItemName.Text = this.dataGridItems.Rows[rowIndex].Cells[1].Value.ToString(); itemUpdate.checkInstance.txtBoxItemType.Text = this.dataGridItems.Rows[rowIndex].Cells[2].Value.ToString(); itemUpdate.checkInstance.txtBoxBuyPrice.Text = this.dataGridItems.Rows[rowIndex].Cells[3].Value.ToString(); itemUpdate.checkInstance.txtBoxSellPrice.Text = this.dataGridItems.Rows[rowIndex].Cells[4].Value.ToString(); itemUpdate.checkInstance.txtBoxQnt.Text = this.dataGridItems.Rows[rowIndex].Cells[5].Value.ToString(); itemUpdate.checkInstance.cmbBoxSupplier.Text = this.dataGridItems.Rows[rowIndex].Cells[8].Value.ToString(); itemUpdate.checkInstance.Show(); }
private void btnUpdate_Click(object sender, EventArgs e) { if (rowIndex.Equals(null)) { MessageBox.Show("Item Not Selected!"); } else { ItemUpdateForm itemUpdate = new ItemUpdateForm(); itemUpdate.checkInstance.txtBoxItemID.Text = this.dataGridItems.Rows[rowIndex].Cells[0].Value.ToString(); itemUpdate.checkInstance.txtBoxItemName.Text = this.dataGridItems.Rows[rowIndex].Cells[1].Value.ToString(); itemUpdate.checkInstance.txtBoxItemType.Text = this.dataGridItems.Rows[rowIndex].Cells[2].Value.ToString(); itemUpdate.checkInstance.txtBoxBuyPrice.Text = this.dataGridItems.Rows[rowIndex].Cells[3].Value.ToString(); itemUpdate.checkInstance.txtBoxSellPrice.Text = this.dataGridItems.Rows[rowIndex].Cells[4].Value.ToString(); itemUpdate.checkInstance.txtBoxQnt.Text = this.dataGridItems.Rows[rowIndex].Cells[5].Value.ToString(); itemUpdate.checkInstance.cmbBoxSupplier.Text = this.dataGridItems.Rows[rowIndex].Cells[8].Value.ToString(); itemUpdate.checkInstance.Show(); } }
private void ItemUpdateForm_FormClosed(object sender, FormClosedEventArgs e) { instance = null; }