0

我的btnNext.

我有btnNext并且我想在第 9 次点击时限制它。

单击 9 次后,该按钮应被禁用。我该怎么做?

Private Sub Button3_Click(ByVal sender As System.Object,
                          ByVal e As System.EventArgs) Handles btnnext.Click
  If btnnext.Text = "Submit" Then
    calculate()
    btnnext.Text = "Next>"
  ElseIf btnnext.Text = "Next>" Then
    CurrentRow += 5
    cat += 5
    showdata()
    updatelbl()
    clear_radio()
    ' calculate_case(1)
    ' calculate_case(2)
    ' calculate_case(3)
    ' calculate_case(4)
    btnnext.Text = "Submit"
    If CurrentRow & cat = ds.Tables("evaluation").Rows.Count >= 20 Then
      MsgBox("Last Questions is Reached!!!")
    End If
    If btnnext.Text = "Management of Learning" Then
      btnnext.Text = "Finish"
      If btnnext.Text = "Finish" Then
        CurrentRow = 35
        cat = 35
        MsgBox("Comment")
      End If
    End If
  End If
End Sub
4

2 回答 2

3
 Private btnCount As Integer
 Private Sub Button3_Click(...)...
  btnCount += 1
  If btnCount = 9 Then Button3.Enabled = False
  'remainder of code here...
于 2013-09-19T16:18:18.100 回答
3

像这样

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Static ctClicks As Integer = 0
    ctClicks += 1
    If ctClicks = 9 Then Button1.Enabled = False
    'other code
    '
End Sub
于 2013-09-19T16:19:18.423 回答