【发布时间】:2012-07-16 02:13:18
【问题描述】:
我有一个值为 0.00 的文本框,然后我得到一个错误转换...但我 已经做了一个 0.00 的例子,而不是来自文本框,它正在工作。我该如何解决这个问题?
Dim _Total, _Deduct, _Charges As String
Dim _sss, _tax, _pf, _ph, _loan, _others, _hdmf, _cola, _allowance As Decimal
如果文本框和注释此行有效,则此行.. 但我使用此行不工作..
_sss = txtSSS.Text : _ph = txtPH.Text : _tax = txtInTax.Text : _pf = txtPF.Text
_loan = txtLoan.Text : _hdmf = txtHDMF.Text : _others = txtOther.Text
_cola = txtCola.ToString : _allowance = txtAllowance.ToString
这一行是我给定的示例值...相同的值但文本框不工作..这是工作
'This code when I uncomment.. this work..
'_sss = "0.00": _ph = "0.00" : _tax = "0.00" : _pf = "0.00"
'_loan = "0.00" : _hdmf = "50.00" : _others = "0.00"
'_cola = "0.00" : _allowance = "0.00"
_Charges = CDec(_cola) + CDec(_allowance)
_Deduct = CDec(_sss) + CDec(_tax) + CDec(_pf) + CDec(_ph) + CDec(_loan) + CDec(_hdmf) + CDec(_others)
_Total = CDec(_Charges) - CDec(_Deduct)
lblDeduct.Text = Format((_Deduct), "currency")
lblTotal.Text = FormatCurrency((_Total), 2, TriState.True, TriState.False, TriState.True)
【问题讨论】:
标签: vb.net visual-studio-2010 sql-server-2008 vb.net-2010