The following information is for the Complementary Technologies

Open method

sms1.Open(textBox3.Text);

Opens the connection to the GSM modem.

bool Open(string Portnum)

Parameters

Portnum - The comm port number the GSM modem is connected to.

Return Value

true if open is successful otherwise false

Close method

sms1.Close();

Close the GSM modem connection.

void Close()

Query method

sms1.Query();

Used to identify the GSM modem. When the GSM replies, the onReceived event occurs and the identification string is assigned to the sresult property.

void Query()

Send method

sms1.Send(textBox1.Text, textBox2.Text);

The Send method is used to send an SMS to another phone. Two strings are passed, one for the message and the other for the phone number.

void Send(string smsg, string sphone)

Parameters

smsg - message string that is sent to the destination phone
sphone - string of the phone number of the destination phone

sresult Property

The message or status from the modem is returned as a string and assigned to the sresult property.

public string sresult {get;}

Property Value

string of the message or status

onReceived Event

The event occurs when the modem receives an SMS message or reports a status or acknowledgement. The information is stored in the sresult property.

private void sms1_onReceived(object sender, EventArgs e)
{
Control.CheckForIllegalCrossThreadCalls = false;
label1.Text = sms1.sresult;
}

This CheckForIllegalCrossThreadCalls property is new in the .NET Framework version 2.0. Gets or sets a value indicating whether to catch calls on the wrong thread that access a control's Handle property. If left as default true, you will get the following runtime error.

"Cross-thread operation not valid: Control label1 accessed from a thread other than the thread it was created on."

Control.CheckForIllegalCrossThreadCalls = false;

Setting it false is a quick fix.

Short Message Service SMS Page 1 | 2 | 3 | 4 | 5