其他 mRackc = 0 结束如果 如果IsNumeric(txtJacoEC.Text)= True那么 mJaEc = txtJacoEC.Text 其他 mJaEc = 0 如果IsNumeric(txtWfEC.Text)=真的然后 mWfEC = txtWfEC.Text 其他 mWfEC = 0 结束如果 如果IsNumeric(txtFactorAdjust.Text)= True那么 mFactorAdj = txtFactorAdjust.Text 其他 mFactorAdj = 0 结束如果 txtJacoCost.Text =格式(mRackc - (mDisc + mJaEc),0。##### 0) txtWfCost。 Text = Format(mRackc - mDisc + mWfEC," 0。##### 0") txtFactorCost.Text =格式(mRackc - (mDisc + mFactorAdj)," 0。## ### 0") 结束Sub mDisc的价值是多少?如果它是一个负值,那么它将会增加...... - a - 等于一个加号: 1 - -2 = 1 + +2 = 3 - Tom Shelton " Bill Nguyen" < bi ***************** @ jaco.comschrieb Tom; 这是一个积极的价值。 我反复测试过。 请告诉我们问题发生的确切行和 行中所有变量的所有值。 我也有一个类似的问题,位值为1(真)显示 为-1在VS2005 您应该切换Option Strict On Armin I''m running into a very weird problem regarding subtraction.Subtraction behaves as if it''s an addition in the below subtxtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0")txtWfCost.Text = Format(mRackc - mDisc + mWfEC, "0.#####0")txtFactorCost.Text = Format(mRackc - (mDisc + mFactorAdj), "0.#####0")the discount mDisc was added to the total with the - operator!Your help is greatly appreciated.Bill--------Private Sub txtDiscount_TextChanged(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles txtDiscount.TextChangedDim mDisc, mRackc, mJaEc, mWfEC, mFactorAdj As DoubleIf IsNumeric(txtDiscount.Text) = True ThenmDisc = txtDiscount.TextElsemDisc = 0End IfIf IsNumeric(txtRackCost.Text) = True ThenmRackc = txtRackCost.TextElsemRackc = 0End IfIf IsNumeric(txtJacoEC.Text) = True ThenmJaEc = txtJacoEC.TextElsemJaEc = 0End IfIf IsNumeric(txtWfEC.Text) = True ThenmWfEC = txtWfEC.TextElsemWfEC = 0End IfIf IsNumeric(txtFactorAdjust.Text) = True ThenmFactorAdj = txtFactorAdjust.TextElsemFactorAdj = 0End IftxtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0")txtWfCost.Text = Format(mRackc - mDisc + mWfEC, "0.#####0")txtFactorCost.Text = Format(mRackc - (mDisc + mFactorAdj), "0.#####0")End Sub 解决方案 On Oct 17, 3:55 pm, "Bill Nguyen" <[email protected]>wrote:I''m running into a very weird problem regarding subtraction.Subtraction behaves as if it''s an addition in the below subtxtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0")txtWfCost.Text = Format(mRackc - mDisc + mWfEC, "0.#####0")txtFactorCost.Text = Format(mRackc - (mDisc + mFactorAdj), "0.#####0")the discount mDisc was added to the total with the - operator!Your help is greatly appreciated.Bill--------Private Sub txtDiscount_TextChanged(ByVal sender As System.Object, ByVal eAs System.EventArgs) Handles txtDiscount.TextChangedDim mDisc, mRackc, mJaEc, mWfEC, mFactorAdj As DoubleIf IsNumeric(txtDiscount.Text) = True ThenmDisc = txtDiscount.TextElsemDisc = 0End IfIf IsNumeric(txtRackCost.Text) = True ThenmRackc = txtRackCost.TextElsemRackc = 0End IfIf IsNumeric(txtJacoEC.Text) = True ThenmJaEc = txtJacoEC.TextElsemJaEc = 0End IfIf IsNumeric(txtWfEC.Text) = True ThenmWfEC = txtWfEC.TextElsemWfEC = 0End IfIf IsNumeric(txtFactorAdjust.Text) = True ThenmFactorAdj = txtFactorAdjust.TextElsemFactorAdj = 0End IftxtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0")txtWfCost.Text = Format(mRackc - mDisc + mWfEC, "0.#####0")txtFactorCost.Text = Format(mRackc - (mDisc + mFactorAdj), "0.#####0")End SubWhat was the value of mDisc? If it is a negative value, then it willadd... - a - equals a plus:1 - -2 =1 + +2 = 3--Tom Shelton Tom;It''s a positive value.I tested repeatedly.I also have a similar problem with a bit value of 1 (true) is shown as -1 inVS2005ThanksBill-----------Below is my VS version info:Microsoft Visual Studio 2005Version 8.0.50727.762 (SP.050727-7600)Microsoft .NET FrameworkVersion 2.0.50727Installed Edition: ProfessionalMicrosoft Visual Basic 2005 77626-009-0000007-41468Microsoft Visual Basic 2005Microsoft Visual C# 2005 77626-009-0000007-41468Microsoft Visual C# 2005Microsoft Visual C++ 2005 77626-009-0000007-41468Microsoft Visual C++ 2005Microsoft Visual J# 2005 77626-009-0000007-41468Microsoft Visual J# 2005Microsoft Visual Web Developer 2005 77626-009-0000007-41468Microsoft Visual Web Developer 2005Microsoft Web Application Projects 2005 77626-009-0000007-41468Microsoft Web Application Projects 2005Version 8.0.50727.762Crystal Reports AAC60-G0CSA4B-V7000AYCrystal Reports for Visual Studio 2005Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1(KB926601)This service pack is for Microsoft Visual Studio 2005 Professional Edition -ENU.If you later install a more recent service pack, this service pack will beuninstalled automatically.For more information, visit http://support.microsoft.com/kb/926601Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU(KB937061)This Security Update is for Microsoft Visual Studio 2005 ProfessionalEdition - ENU.If you later install a more recent service pack, this Security Update willbe uninstalled automatically.For more information, visit http://support.microsoft.com/kb/937061SQL Server Analysis ServicesMicrosoft SQL Server Analysis Services DesignerVersion 9.00.3042.00SQL Server Integration ServicesMicrosoft SQL Server Integration Services DesignerVersion 9.00.2047.00SQL Server Reporting ServicesMicrosoft SQL Server Reporting Services DesignersVersion 9.00.2047.00"Tom Shelton" <to*********@comcast.netwrote in messagenews:11**********************@t8g2000prg.googlegro ups.com...On Oct 17, 3:55 pm, "Bill Nguyen" <[email protected]>wrote:>I''m running into a very weird problem regarding subtraction.Subtraction behaves as if it''s an addition in the below subtxtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0")txtWfCost.Text = Format(mRackc - mDisc + mWfEC, "0.#####0")txtFactorCost.Text = Format(mRackc - (mDisc + mFactorAdj), "0.#####0")the discount mDisc was added to the total with the - operator!Your help is greatly appreciated.Bill--------Private Sub txtDiscount_TextChanged(ByVal sender As System.Object, ByValeAs System.EventArgs) Handles txtDiscount.TextChangedDim mDisc, mRackc, mJaEc, mWfEC, mFactorAdj As DoubleIf IsNumeric(txtDiscount.Text) = True ThenmDisc = txtDiscount.TextElsemDisc = 0End IfIf IsNumeric(txtRackCost.Text) = True ThenmRackc = txtRackCost.TextElsemRackc = 0End IfIf IsNumeric(txtJacoEC.Text) = True ThenmJaEc = txtJacoEC.TextElsemJaEc = 0End IfIf IsNumeric(txtWfEC.Text) = True ThenmWfEC = txtWfEC.TextElsemWfEC = 0End IfIf IsNumeric(txtFactorAdjust.Text) = True ThenmFactorAdj = txtFactorAdjust.TextElsemFactorAdj = 0End IftxtJacoCost.Text = Format(mRackc - (mDisc + mJaEc), "0.#####0")txtWfCost.Text = Format(mRackc - mDisc + mWfEC, "0.#####0")txtFactorCost.Text = Format(mRackc - (mDisc + mFactorAdj), "0.#####0")End SubWhat was the value of mDisc? If it is a negative value, then it willadd... - a - equals a plus:1 - -2 =1 + +2 = 3--Tom Shelton "Bill Nguyen" <bi*****************@jaco.comschriebTom;It''s a positive value.I tested repeatedly.Please show us the exact line where the problem occurs and all the values inall variables in the line.I also have a similar problem with a bit value of 1 (true) is shownas -1 in VS2005You should switch Option Strict OnArmin 这篇关于奇怪的数学问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-05 20:33