【发布时间】:2021-09-20 20:38:17
【问题描述】:
在我的应用中,我想通过文本框通过按钮计算价格(净)->(毛)。
我从文本框 txtPurchasingPrice 中获取值。
但是由于值是作为字符串存储在数据库中的,当然我也会遇到转换错误。
转换是最少的问题。
如何获取计算到标签或文本框中的值? (不将其保存到数据库中)。它应该只显示。如果需要,当您单击按钮时。
private void btnPriceCalculation_Click(object sender, EventArgs e)
{
if(txtPurchasingPrice.Text == null)
{
MessageBox.Show("Bitte gib den Einkaufspreis Netto an.");
return;
}
double PurchasingPrice = Convert.ToInt32(txtPurchasingPrice.Text);
double PurchasingPriceBrut = Convert.ToInt32(PurchasingPrice * 0.19);
PurchasingPriceBrut = Convert.ToInt32(txtPurchasingPriceBrut.Text);
}
【问题讨论】:
标签: c# type-conversion price