private void addNewProductToolStripMenuItem_Click(object sender, EventArgs e) { AddNewProduct frm = new AddNewProduct(); frm.MdiParent = this; frm.StartPosition = FormStartPosition.CenterScreen; frm.Show(); }
private void tblProductsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && tblProductsDataGridView.Columns[e.ColumnIndex].Name == "EditColumn") { DataRowView drv = tblProductsDataGridView.Rows[e.RowIndex].DataBoundItem as DataRowView; AddNewProduct frm = new AddNewProduct(Convert.ToInt32(drv.Row["ProductID"])); frm.StartPosition = FormStartPosition.CenterParent; if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { this.tblProductsTableAdapter.FillActiveProducts(this.inventoryStoreDataSet.tblProducts); //if (this.inventoryStoreDataSet.tblProducts.Rows.Count > 0) //{ // tblProductsDataGridView.CurrentCell = tblProductsDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex]; //} } } }