I have just started to learn windows application development, and we have been given self learn project to develop one windows application. I am trying to create the application to send email. I have created a class MsgSender.cs to handle that. When I call that class from main form I am getting the following error

System.InvalidOperationException was unhandled.

Error Message-->

Cross-thread operation not valid: Control 'pictureBox1' accessed from a thread other than the thread it was created on.`

The stacktrace is as follows:

System.InvalidOperationException was unhandled
Message=Cross-thread operation not valid: Control 'pictureBox1' accessed from a thread other than the thread it was created on.
Source=System.Windows.Forms
StackTrace:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at UltooApp.Form1.sendMethod() in D:\Ultoo Application\UltooApp\UltooApp\Form1.cs:line 32
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

@CodeIgnoto i wanted to accept it as answer straightway but the website told me to wait 10 minutes before accepting it as answer. So i waited for 10 minutes and as soon as 10 minutes period was over i marked it as answer immediately.
–
android_newbieNov 16 '12 at 6:06