Thanks for your reply.
I simply dragged a timer onto the form and then put that code under the Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick event.
Apologies if that's not what you meant!
Thanks
Simon
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Good afternoon,
I have created a little application in VB.net which runs fine on my Windows 10 PC but when i run it on another one i get the following message...
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Timezone_Client.Form1.Timer1_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
This is the first part of the code in my application which i believe it relates to.
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Timer1.Interval = 10000
timer1.Start()
Can anyone assist me please?
I am a novice, so please bear with me!
Thanks
Simon
Thanks for your reply.
I simply dragged a timer onto the form and then put that code under the Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick event.
Apologies if that's not what you meant!
Thanks
Simon
Hi @Simon Scott ,
Try starting the timer outside the Tick event:
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
' do something here.
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Interval = 10000
Timer1.Start()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
Click Button1 to start the timer and Button2 to stop it.
Besides, set ‘Enabled’ property 'false'.
Hope it could be helpful.
Best Regards,
Xingyu Zhao
*
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Ok, so i think i may have found where the issue is...
I do have the line Dim sString As String = Nothing further up the page within the same sub
Any advice?
Many thanks
Simon
I believe i have fixed this so hold fire on any possible answers :)