In my application I start an additional thread which continually checks the idle time of the system. If the system has been idle for more than 30 seconds, the thread navigates the application to the begin screen by calling the function "ToBegin()" of frmmain. This works fine except for the fact that I don't succeed in placing the focus to "text1"
I added the "frm.text1.Focus()" command but this does not work. If I add "text1.Focus()" at the end of the function "ToBegin()" this also does not work...
Anyone who knows how I can change the focus to "text1" in my situation?
I start the thread like this:
The code below shows the class I use for the extra thread.
I added the "frm.text1.Focus()" command but this does not work. If I add "text1.Focus()" at the end of the function "ToBegin()" this also does not work...
Anyone who knows how I can change the focus to "text1" in my situation?
I start the thread like this:
Code:
oIdle = New Idle
Dim t As New Threading.Thread(AddressOf oIdle.IdleTime)
oIdle.frm = Me
t.Start()
Application.DoEvents()
The code below shows the class I use for the extra thread.
Code:
Public Class Idle
Dim FormIdle As New sfIdleTime.clsIdleTime
Public frm As frmMain
Public Event ThreadComplete()
Public Sub IdleTime()
Dim Time As Integer
Dim Maxtime As Integer = 30
Begin:
Time = FormIdle.GetIdleTime()
If Time > Maxtime Then
frm.ToBegin()
frm.Focus()
frm.text1.Focus()
System.Threading.Thread.Sleep(10000)
GoTo Begin
Else
GoTo Begin
End If
End Sub
End Class