I want to display an incrementing count and have tried the following method
but with a problem.
My form has the following items:-
A label, lblCount and a textbox, txtCount to display an incrementing count.
A textbox, txtSet to select the count number, initially set to 5000.
A button, btnStart to start the procedure.
A button btnReset to reset on the completion of the procedure before
repeating the procedure.
A button btnCancel to exit the program.
The code for the form is as follows:-
********************************************************************
Public Class Form1
' Declare working variables
Dim i, s As Integer
____________________________________________________________________
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles MyBase.Load
Clear()
End Sub
____________________________________________________________________
Private Sub Clear()
' Set the Label states to Ready
lblCount.Text = "..."
txtCount.Text = "..."
btnReset.Text = "Reset"
btnStart.Text = "Start"
btnCancel.Text = "Cancel"
txtSet.Text = "5000"
End Sub
____________________________________________________________________
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles btnStart.Click
Clear()
s = txtSet.Text ' Set the cycle count
' Incrementing counter
For i = 1 To s
lblCount.Text = i ' Updates label at each count
txtCount.Text = i ' Updates textbox at each count
' When the program runs, I want lblLabel and txtCount
' to be updated and display each count, but they only show
'the final count, when, the process completes.
' How can I make them show an incrementing count?
Next
End Sub
____________________________________________________________________
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles btnReset.Click
Clear()
End Sub
____________________________________________________________________
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles btnCancel.Click
End
End Sub
End Class
____________________________________________________________________
********************************************************************
The procedure operation is as follows:-
The procedure is quite simple, it increments a counter to display the
counter setting via lblCount and txtCount.
The procedure is initiated by clicking the btnStart button.
At each step of the counter, lblCount and txtCount should display the incrementing counter setting but when the program is run they only show the final setting, when the process completes.
My question is, how can I get lblCount and txtCount to display an incrementing count of the counter?