我想弄清楚如何完成這個程序,並獲得計算顯示在文本框中。這是我到目前爲止的基本代碼將採購價格和贖回率並計算折扣和利率。不知道我在做什麼錯誤。vb.net折扣和利率計劃
Option Strict On
Public Class _Default
Inherits System.Web.UI.Page
Dim Purchase As Double
Dim Redemption As Double
Dim DiscountRate As Double
Dim InterestRate As Double
Protected Sub btnCalculate_Click(sender As Object, e As EventArgs) _
Handles btnCalculate.Click
Double.TryParse(txtPurchase.Text, Purchase)
Double.TryParse(txtRedemption.Text, Redemption)
Double.TryParse(txtDiscount.Text, DiscountRate)
Double.TryParse(txtInterest.Text, InterestRate)
If (CDbl(txtPurchase.Text) <= 0) Then
MsgBox("Please enter an amount greater than 0")
End If
If (CDbl(txtRedemption.Text) <= 0) Then
MsgBox("Please enter an amount greater than 0")
End If
DiscountRate = Purchase - Redemption/Purchase
InterestRate = Purchase - Redemption/Redemption
End Sub
End Class
你能解釋一下這個問題? –
@JohnWoo試圖創建一個計算債券折扣和利率的網絡程序。公式正好在購買 - 贖回除以購買和其他方式,但他們沒有顯示出來 – compucrazy
當你在調試器中單步執行時,'DiscountRate'和'InterestRate'在方法的最後得到正確計算? – yhw42