private void dataGridViewPackage_CellValuePushed(object sender, DataGridViewCellValueEventArgs e) { if (_packageTypeList.Count == 0) { return; } PackageTypeList currentPackageType = _packageTypeList[e.RowIndex]; switch (dataGridViewPackage.Columns[e.ColumnIndex].Name) { case "ColumnName": currentPackageType.PackageType = e.Value.ToString(); _packageTypeList[e.RowIndex] = currentPackageType; break; case "ColumnPrice": currentPackageType.PackagePrice = Decimal.Parse(e.Value.ToString(), NumberStyles.Currency); _packageTypeList[e.RowIndex] = currentPackageType; break; case "ColumnCost": currentPackageType.PackageCost = Decimal.Parse(e.Value.ToString(), NumberStyles.Currency); _packageTypeList[e.RowIndex] = currentPackageType; break; } }
private void dataGridViewPackage_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { if (_packageTypeList.Count == 0) { return; } PackageTypeList currentPackageType = _packageTypeList[e.RowIndex]; switch (dataGridViewPackage.Columns[e.ColumnIndex].Name) { case "ColumnName": e.Value = currentPackageType.PackageType; break; case "ColumnPrice": e.Value = currentPackageType.PackagePrice; break; case "ColumnCost": e.Value = currentPackageType.PackageCost; break; } }