you can use an API call in your timer_tick event
vb Code:
Imports System.Runtime.InteropServices
Public Class Form1
Private Declare Function GetLastInputInfo Lib "user32.dll" _
(ByRef plii As PLASTINPUTINFO) As Boolean
Private Structure PLASTINPUTINFO
Dim cbSize As Integer
Dim dwTime As Integer
End Structure
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim oPLII As PLASTINPUTINFO
oPLII.cbSize = Marshal.sizeof(oPLII)
GetLastInputInfo(oPLII)
TextBox1.Text = CType((Environment.TickCount - oPLII.dwTime) / 1000, String)
End Sub
End Class