I have a fully running SMS application which performs a 2 way process of sending and receiving. I am now working on the part of Sending the Received SMS. I will just assure you that I am able to send and receive SMS.
I have a Form named Form1 which has contains 2 textboxes: txtnumber and txtmessage and a button btnSend. When btnSend is Clicked manually the message is sent to the recipients which is indicated in the txtnumber textbox.
I moved the receive functions from my module form to this Form1. When incoming SMS is read through here. It splits the message by the codes below.
'Split parts of the Message Received by "_"
Dim textmess As String() = Message.Split("_")
Dim pass As String = textmess(0)
Dim txt As String = textmess(1)
Dim recipients As String = textmess(2)
All my textboxes and buttons are all hidden.
Then after many if's it goes through this line of code. But on the first part I receive an InvalidOperationException error.
Form1.txtnumber.Text = recipients 'Cross-thread Operation not valid:Control 'txtnumber' accessed from a thread other than the thread it was created on.
Form1.txtmessage.Text = txt
Form1.btnSend.PerformClick()
The error message is:
Cross-thread Operation not valid:
Control 'txtnumber' accessed from a thread other than the thread it was created on
Any help would be appreciated.