Hi all,
I am implementing an idle function whereby if the application has no input for a few seconds, it will refresh the DataGridView table.
To implement, if the app is idle, an IdleTimer will start.
If the user moves mouse or press a key, the IdleTimer will stop, hence resetting the timeout.
Application_Idle works
MouseMove worksCode:Private Sub Application_Idle(ByVal sender As Object, ByVal e As EventArgs) IdleTimer.Start() End Sub
KeyDown does not work. The MessageBox does not appear.Code:Private Sub adminViewForm_MouseMove(sender As Object, e As MouseEventArgs) Handles Me.MouseMove MessageBox.Show("MouseMove") IdleTimer.Stop() End Sub
Code:Private Sub adminViewForm_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown MessageBox.Show("KeyPress") IdleTimer.Stop() End Sub
Refresh Table
Code:Private Sub IdleTimer_Tick(sender As Object, e As EventArgs) Handles IdleTimer.Tick EVC_ProjectsDataSet.Clear() ProjectsTableAdapter.Fill(EVC_ProjectsDataSet.Projects) save_btn.BackColor = DefaultBackColor AddNew_btn.Enabled = True End Sub
Any advise is appreciated.




Reply With Quote
