private void monitorDataGrid_CellEndEdit(object sender, DataGridViewCellEventArgs e) { ItemsDatabase db = new ItemsDatabase(); var row = softwareDataGrid.CurrentCell.RowIndex; var column = softwareDataGrid.CurrentCell.ColumnIndex; string resolution = monitorDataGrid.Rows[row].Cells[0].Value.ToString(); string monitorType = monitorDataGrid.Rows[row].Cells[1].Value.ToString(); double weight = Convert.ToDouble(computerDataGrid.Rows[row].Cells[2].Value); string itemID = hardwareDataGrid.Rows[row].Cells[3].Value.ToString(); string itemName = hardwareDataGrid.Rows[row].Cells[4].Value.ToString(); double price = Convert.ToDouble(hardwareDataGrid.Rows[row].Cells[5].Value); Monitor monitor = new Monitor(itemID, itemName, price, weight, resolution, monitorType); db.EditMonitor(monitor); }