Calculating totals Amounts of a transaction in window formJyoti Jodha9yAsked Apr 28, 2017, 6:40 AM1.2kWindows Forms
Rafnas T P9y agoPosted Apr 28, 2017, 6:51 AMAccepted answerdecimal _ttl = Convert.ToDecimal(txtTtl.Text); decimal discount, shopcost; if (discounttxt.Text != "" && chk_DiscPerct.Checked==true) { discount = (_ttl * Convert.ToDecimal(discounttxt.Text)) / 100; } else if (discounttxt.Text != "") { discount = Convert.ToDecimal(discounttxt.Text); } else { discount = 0; } if (addcosttxt.Text != "") { shopcost = Convert.ToDecimal(addcosttxt.Text); } else { shopcost = 0; } txtsubttotal.Text = (_ttl + shopcost).ToString(); txtNewTotal.Text = (Convert.ToDecimal(txtsubttotal.Text) - discount).ToString();+2
Deepak Sharma9y agoPosted May 1, 2017, 11:54 AMHi Jyoti, i have the form but this is something different if you want to calculate the total amount like total Amount + tax + shipping cost = sub total - discount and that you want the final amount. if i'm right you want to do like this please let me know i'll give you the coding +1
Jyoti Jodha9y agoPosted May 1, 2017, 2:27 AM values don't show in txtsubttotal.TextProparly don't work txtsubttotal.Text +1
Vinay Singh9y agoPosted Apr 28, 2017, 6:56 AMchekc the codeint subtotal=convert.ToInt32(txtTotleAmount.Text)+convert.ToInt32(txtTaxAmount.Text)+convert.ToInt32(txtShipmentAmount.Text);txtSubtotla.Text=subtotal;double discount=subtotal*Convert.ToDouble(txtDiscount.Text)/100;double txtNettotal=subtotal-discount; +1
Rafnas T PPosted Apr 28, 2017, 6:51 AM
if (discounttxt.Text != "" && chk_DiscPerct.Checked==true)
{
discount = (_ttl * Convert.ToDecimal(discounttxt.Text)) / 100;
}
else if (discounttxt.Text != "")
{
discount = Convert.ToDecimal(discounttxt.Text);
}
else { discount = 0; }
if (addcosttxt.Text != "")
{
shopcost = Convert.ToDecimal(addcosttxt.Text);
}
else { shopcost = 0; }
txtsubttotal.Text = (_ttl + shopcost).ToString();
txtNewTotal.Text = (Convert.ToDecimal(txtsubttotal.Text) - discount).ToString();
Deepak SharmaPosted May 1, 2017, 11:54 AM
Jyoti JodhaPosted May 1, 2017, 2:27 AM
Vinay SinghPosted Apr 28, 2017, 6:56 AM