(EventArgs csharp (Resolved
פארעפענטליכט: דינסטאג ינואר 22, 2013 10:19 am
איך וויל רופן די מעטהאד פון א באטטאן פאר יעדע רייע אינעם גריד
מיין שאלה איז וויאזוי פעס איך אריין די DataGridViewCellEventArgs פאר די מעטהאד
זעה בילד
דא איז די מעטהאד
מיין שאלה איז וויאזוי פעס איך אריין די DataGridViewCellEventArgs פאר די מעטהאד
זעה בילד
דא איז די מעטהאד
- קאוד:
private void recipeIngredientsDataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0 && e.ColumnIndex != 5)
{
try
{
DataGridView dgv = this.recipeIngredientsDataGridView;
Int32 ingredientID = (Int32)dgv.Rows[e.RowIndex].Cells[2].Value;
decimal numberOfUnits = (decimal)dgv.Rows[e.RowIndex].Cells[3].Value;
Int32 unitMeasureID = (Int32)dgv.Rows[e.RowIndex].Cells[4].Value;
RecipeIngredient ri = new RecipeIngredient(ingredientID, numberOfUnits, unitMeasureID);
if (ri.Cost == 999999m)
{
MessageBox.Show("Could Not Calculate Cost!");
dgv.Rows[e.RowIndex].Cells[5].Value = 0m;
CalcRecipeCost(dgv);
}
else
{
dgv.Rows[e.RowIndex].Cells[5].Value = ri.Cost;
CalcRecipeCost(dgv);
}
}
catch (Exception)
{
}
}
}