TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Zygis
NA
14
13.8k
Help with using .Invoke()
May 17 2011 8:28 AM
Hello again,
Here's the thing: I get an error "Cross-thread operation not valid: Control 'pictureBox1' accessed from a thread other than the thread it was created on.";
Here's the situation: I start System.Timers.Timer in Class33(Form), when the timer elapses it calls a method which makes another class - Class1(Not a Form, just a class). When Class1 code is being executed it "wants" to change picture on the Class33(Form) and then i get that error.
Here's what i found:
1) i could use Control.CheckForIllegalCrossThreadCalls, but it's not very good choice;
2) I should use .Invoke() method which is good;
Here's the problem: I don't understand how to use it. What should I invoke: Class33 or Class1 or something else...?
Hope you have understood my problem, thank you.
Reply
Answers (
4
)
[WINFORM] Read PCAP logs and Display in Datagrid
[WINFORM] Run Teraterm and Execute Commands using C#