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
You can access Form GUI controls in GUI thread
and you are trying to access outside GUI thread that is the reason for getting exception. You can use MethodInvoker to access controls in the GUI thread.
void sendMethod()
{
MethodInvoker mi = delegate{
string lblText = (String) MsgSender.sendSMS(to, msg, "hotmail", uname, pwd);
pictureBox1.Visible = false;
lblMsgStatus.Visible = true;
lblMsgStatus.Text =
lblText + "\nFrom: " + uname +
" To: " + cmbxNumber.SelectedItem + " " + count;
};
if(InvokeRequired)
this.Invoke(mi);
}