Code should work fine. Problem is in timer duration. The duration 5000 is actually seconds not milliseconds. So your timer will be fired but after 5000 seconds(i.e. after 1 hour 23 minutes and 20 seconds). If you want to fire it after 5 seconds then set the duration to 5 only.