The value of FlagRight and FlagLeft is being reset on each Timer Tick with
Dim flagRight As Integer = 0
inside the event handler., which is why your attempt to set its value to 1 as a means of stopping it fails.
I am not exactly sure what it is that you want to do though.
If you want to post up more of an explanation of the steps you want to happen it would be easier to show you the appropriate code.
(Just something along the lines of “User clicks button – Timer is enabled, Random images are shown, when user does <whatever> images change … etc)