How to change label content with timers throwing InvalidOperationException.
Posted
by Guru
on Stack Overflow
See other posts from Stack Overflow
or by Guru
Published on 2010-04-26T07:02:16Z
Indexed on
2010/04/26
7:23 UTC
Read the original article
Hit count: 238
Hi there,
I'm making an application and I'm using a timer in that application to change label content in WPF C# .NET.
In timer elapsed event I'm writing the following code
lblTimer.Content = "hello";
but its throwing an InvalidOperationException and gives a message "The calling thread cannot access this object because a different thread owns it."
I'm using .NET framework 3.5 and WPF with C#.
Please help me. Thanks in advance.
© Stack Overflow or respective owner