M
marcmc
I have a label with string that says "Hit OK Button"
I want to make the text scroll across the screen 1 char
at a time giving the impression that it is moving from
left to right. I have coded as follows:
Private Sub pnlMain_GotFocus(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
pnlMain.GotFocus
MessageBox.Show("1")
Dim thread1 As Thread
thread1 = New Thread(New ThreadStart(AddressOf
workerThread))
threadState = True
thread1.Start()
End Sub
Private Sub workerThread()
Dim LenChar As Integer
LenChar = lblThread.Text.Length()
While threadState = True
Dim firstChar As String
Dim secondChar As String
firstChar = lblThread.Text.Chars(0)
lblThread.Text = firstChar
secondChar = lblThread.Text.Chars(0 + 1)
lblThread.Text = secondChar
threadState = False
End While
Return
End Sub
The firstChar gets populated with "H" which is ok
I get an out of range exception on the line where I try
to assign a value to the variable secondChar.
Any ideas how to get this to work?
I want to make the text scroll across the screen 1 char
at a time giving the impression that it is moving from
left to right. I have coded as follows:
Private Sub pnlMain_GotFocus(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
pnlMain.GotFocus
MessageBox.Show("1")
Dim thread1 As Thread
thread1 = New Thread(New ThreadStart(AddressOf
workerThread))
threadState = True
thread1.Start()
End Sub
Private Sub workerThread()
Dim LenChar As Integer
LenChar = lblThread.Text.Length()
While threadState = True
Dim firstChar As String
Dim secondChar As String
firstChar = lblThread.Text.Chars(0)
lblThread.Text = firstChar
secondChar = lblThread.Text.Chars(0 + 1)
lblThread.Text = secondChar
threadState = False
End While
Return
End Sub
The firstChar gets populated with "H" which is ok
I get an out of range exception on the line where I try
to assign a value to the variable secondChar.
Any ideas how to get this to work?