Imports System Imports System.IO.Ports Imports System.Threading Connection Code: Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Try With SerialPort1 .PortName = ComboBox2.Text .BaudRate = 9600 .Parity = Parity.None .StopBits = StopBits.One .DataBits = 8 .Handshake = Handshake.RequestToSend .DtrEnable = True .RtsEnable = True .NewLine = vbCrLf .Open() End With Label5.Text = " Connection With Modem OK!" Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Try If SerialPort1.IsOpen Then With SerialPort1 .Write("AT" & vbCrLf) .Write("AT+CMGF=1" & vbCrLf) .Write("AT+CMGS=" & Chr(34) & Label1.Text & Chr(34) & vbCrLf) .Write(RichTextBox1.Text & Chr(26)) 'Put some code in here to send the SMS Label3.Text = "sending SMS to " + Label1.Text End With Else MsgBox("Sorry ! there is some error in your computer port") End If Catch ex As Exception MsgBox(ex.Message) End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)