我正在使用asp.net vb,网站在客户端。我不知道如何执行此计算。该网站将设置付款计划。时间范围是 12 个月,最低付款金额可以是 25,但如果他们输入超过 25 是可以的。1.如果余额小于25,那么标签会显示他们无法设置pmt计划,但是如果我将其更改为余额的金额,则没有任何反应,它仍然显示标签的错误并且没有如果我做对了,不要让我继续前进。2. 我如何确保用户停留在指南之间,否则他们无法进入祝贺页面?下面是我的代码,但它不起作用,我的逻辑不起作用。有人可以帮我解决这个问题。这是默认页面:
<form id="form1" runat="server">
<div>
Enter balance<br />
<asp:TextBox ID="Balance" runat="server"></asp:TextBox>
<br />
Enter amount to pay<br />
<asp:TextBox ID="PmtAmount" runat="server" AutoPostBack="True"></asp:TextBox>
<br />
<asp:Label runat="server" ID="lblError" Text=""></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="submit" Width="90px" />
</div>
</form>
后面的代码:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Page.IsPostBack Then
End If
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim pmt As Decimal
Dim bal As Decimal
Dim minpmt As Decimal
If Not Decimal.TryParse(Balance.Text, bal) OrElse _
Not Decimal.TryParse(PmtAmount.Text, pmt) Then
lblError.Visible = True
lblError.Text = "Balance and Payment Amount must be a decimal"
Else
If bal < 25.0 Then
lblError.Visible = True
lblError.Text = "You can't set a pymt plan, please pay in full"
ElseIf pmt < 25.0 Then
lblError.Visible = True
lblError.Text = "min is 25.00"
ElseIf bal > 300.0 Then
minpmt = bal / 12
lblError.Visible = True
lblError.Text = "your min pmt is " & Math.Round(minpmt, 2)
ElseIf pmt > (bal / 12) Then
Response.Redirect("default2.aspx")
End If
End If