J
Jerry Haynes
I've looked in the July 2003 version of the MSDN Library and I'm not getting
much support on the Application.DoEvent method. I've written a small app to
get an idea of how it works and am having some difficulty. I simply want
the program to process the Ones() and Tens() subroutines at the same time
and when I press the "Stop" button, the program ends, but with the code
below, its only processing the Ones() subroutines and never gets to the
Tens(). Thanks to all that reply!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Button1.Text = "Start" Then
Button1.Text = "Stop"
Application.DoEvents()
Call Ones()
Call Tens()
Application.DoEvents()
Else
Application.Exit()
End If
End Sub
Private Sub Ones()
Do
Me.txtOnes.Text = Str(Val(Me.txtOnes.Text.ToString) + 1)
Me.txtOnes.Refresh()
Loop
End Sub
Private Sub Tens()
Do
Me.txtTens.Text = Str(Val(Me.txtTens.Text.ToString) + 10)
Me.txtTens.Refresh()
Loop
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
txtOnes.Text = 0
txtTens.Text = 0
End Sub
much support on the Application.DoEvent method. I've written a small app to
get an idea of how it works and am having some difficulty. I simply want
the program to process the Ones() and Tens() subroutines at the same time
and when I press the "Stop" button, the program ends, but with the code
below, its only processing the Ones() subroutines and never gets to the
Tens(). Thanks to all that reply!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Button1.Text = "Start" Then
Button1.Text = "Stop"
Application.DoEvents()
Call Ones()
Call Tens()
Application.DoEvents()
Else
Application.Exit()
End If
End Sub
Private Sub Ones()
Do
Me.txtOnes.Text = Str(Val(Me.txtOnes.Text.ToString) + 1)
Me.txtOnes.Refresh()
Loop
End Sub
Private Sub Tens()
Do
Me.txtTens.Text = Str(Val(Me.txtTens.Text.ToString) + 10)
Me.txtTens.Refresh()
Loop
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
txtOnes.Text = 0
txtTens.Text = 0
End Sub