我试图弄清楚如何完成这个程序并让计算结果显示在文本框中。这是我到目前为止所拥有的,基本上代码将采用购买价格和赎回率并计算折扣和利率。不知道我做错了什么。
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