D
Dave
My application loops through each unit in an array and displays it on the
screen (in a label) for a pre-set amount of time.
It runs fine, but while it's running if I move my stylus around the screen
or "mouseover" buttons on my form or click on the menu, the system will
freeze up. I've tried taking out blocks of code in the thread to find the
trouble spot but it hangs ragardless. I've tried Try-Catch-Finally-End Try
statements and they don't catch an error (the application just freezes.
I've tried On Error Resume Next with the same result. Below is my code for
the thread if that helps:
Private Sub DisplayText()
Dim ReadingWord As String
CurrentTextArrayItem = 0
Dim SentenceItem As String
Dim Counter As Integer
If Not WordNumberSearchingFor > 0 Then
WordNumberSearchingFor = 0
End If
CurrentTextArrayItem = WordNumberSearchingFor
FirstSentenceHit = True
For Counter = WordNumberSearchingFor To EntireTextArray.Count
Try
LocalTextSpeed = scroll_Speed.Maximum + scroll_Speed.Minimum -
scroll_Speed.Value()
If Microsoft.VisualBasic.Len(lbl_Word.Text) > 0 Then
System.Threading.Thread.Sleep(LocalTextSpeed)
lbl_Word.Text = EntireTextArray.Item(Counter)
End If
Catch ex As Exception
MsgBox("caught error and exiting - " & ex.Message.ToString)
Application.Exit()
Finally
CurrentTextArrayItem = 1 + CurrentTextArrayItem
End Try
Next
End Sub
screen (in a label) for a pre-set amount of time.
It runs fine, but while it's running if I move my stylus around the screen
or "mouseover" buttons on my form or click on the menu, the system will
freeze up. I've tried taking out blocks of code in the thread to find the
trouble spot but it hangs ragardless. I've tried Try-Catch-Finally-End Try
statements and they don't catch an error (the application just freezes.
I've tried On Error Resume Next with the same result. Below is my code for
the thread if that helps:
Private Sub DisplayText()
Dim ReadingWord As String
CurrentTextArrayItem = 0
Dim SentenceItem As String
Dim Counter As Integer
If Not WordNumberSearchingFor > 0 Then
WordNumberSearchingFor = 0
End If
CurrentTextArrayItem = WordNumberSearchingFor
FirstSentenceHit = True
For Counter = WordNumberSearchingFor To EntireTextArray.Count
Try
LocalTextSpeed = scroll_Speed.Maximum + scroll_Speed.Minimum -
scroll_Speed.Value()
If Microsoft.VisualBasic.Len(lbl_Word.Text) > 0 Then
System.Threading.Thread.Sleep(LocalTextSpeed)
lbl_Word.Text = EntireTextArray.Item(Counter)
End If
Catch ex As Exception
MsgBox("caught error and exiting - " & ex.Message.ToString)
Application.Exit()
Finally
CurrentTextArrayItem = 1 + CurrentTextArrayItem
End Try
Next
End Sub