Reputation: 7
I have a problem with my btnNext
.
I have btnNext
and I want to limit it at its 9thclick.
After 9 clicks the button should become disabled. How do I do it?
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
Upvotes: 0
Views: 1003
Reputation: 11773
Like this
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
Upvotes: 3
Reputation: 9024
Private btnCount As Integer
Private Sub Button3_Click(...)...
btnCount += 1
If btnCount = 9 Then Button3.Enabled = False
'remainder of code here...
Upvotes: 3