I am using DispatcherTimer in my WPF application, following is the link from where I learned it


Now problem is I cant make it available outside the procedure, and declaring it globally throws error.
Is there any way to make it global?
Or any other way to use timer in WPF?

Recommended Answers

All 2 Replies

Got the solution :)

Dim dispatcherTimer = New Threading.DispatcherTimer()

I changed declaration from above to

 Dim DispatcherTimer1 As New DispatcherTimer()

Can anybody tell me what is difference between these both declaration?
I am using .NET 3.5

 Dim dispatcherTimer = New Threading.DispatcherTimer()

Over here dispatcherTimer doesn't exist and you are setting it equal to a New Threading.DispatcherTimer() where as now

Dim DispatcherTimer1 As New DispatcherTimer()

you are creating it as a new dispatcher timer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.