我得到了这段代码,它计算summary of 2 multiplied columns
所有行的,datagridview
并在textbox
.
我有第三列sum
,我想在其中显示每一行的特定结果。很抱歉,因为我不知道该怎么做,所以我还没有尝试过任何事情。请给我指路好吗?
感谢大家的时间,评论或答案。
private void vypocti_odvody(int price, int vat, int tot_rows2)
{
try
{
double outVal = 0;
foreach (DataGridViewRow row in dataGridView1.Rows)
{
outVal = outVal + (Convert.ToDouble(row.Cells[price].Value)/100) * Convert.ToDouble(row.Cells[vat].Value) + (Convert.ToDouble(row.Cells[price].Value));
}
// s_ub_celk.Text = (((a / 100) * b) + a).ToString();
Convert.ToDecimal ( result.Text = outVal.ToString()) ;
}
catch (Exception ex)
{
MessageBox.Show("Chybové hlášení K3 " + ex.Message.ToString());
}
}