一旦计数器达到 10,它就会显示“您的票是免费的”。我不知道如何重置计数器,以便再点击 10 次将显示“您的票是免费的”
Public Class Form1
Dim intCounter As Integer
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim intTicketPrice As Integer = Val(Me.txtTicketNum.Text) * 8
intCounter = intCounter + 1
If intCounter = 10 Then
Me.lblFeed.Text = "Your tickets are free!!!"
ElseIf intTicketPrice Then
Me.lblFeed.Text = "Your tickets cost: " & intTicketPrice & " Dollars"
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
intCounter = 0
End Sub
End Class