private void InventoryListdataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { var table = (sender as DataGridView).DataSource as DataTable; if (e.RowIndex < table.Rows.Count) { var row = ((DataRowView)(sender as DataGridView).Rows[e.RowIndex].DataBoundItem).Row.ItemArray; //MessageBox.Show(row[1].ToString()); int id = Int32.Parse(row[0].ToString()); //String name = row[1].ToString(); //MessageBox.Show(id); InventoryAddNew form = new InventoryAddNew(id); form.ShowDialog(this); //DB.Instance.Update("update customer set first_name='" + name + "' where id=" + id); } } }
private void addNewToolStripMenuItem_Click(object sender, EventArgs e) { InventoryAddNew ian = new InventoryAddNew(-1); ian.ShowDialog(this); }