2
我想句柄值改變,所以我可以使計算轉換e.NewValue爲十進制
private void supplierDiscountPercetangeSpinEdit_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
decimal price, percentage, calculatedPrice;
price = (decimal)supplierPriceSpinEdit.EditValue;
percentage = Convert.ToDecimal(e.NewValue); // breakpoint 1
calculatedPrice = Popust.Izracunaj(price, percentage); // breakpoint 2
supplierPriceWithDiscountSpinEdit.EditValue = calculatedPrice;
}
在斷點1 e.NewValue
是object {string} "1.00"
在斷點2 percentage
是object {decimal} 100
,它必須是1.00M
如何將e.NewValue
轉換爲deci發作?
已經嘗試過解析,但它只是忽略小數大關。 – Carlo