Imports System Imports System.Threading Imports System.ComponentModel Imports System.IO.Ports Public Class Form1 Private WithEvents SMSPort As SerialPort Private SMSThread As Thread Private ReadThread As Thread Shared _Continue As Boolean = False Shared _ContSMS As Boolean = False Private _Wait As Boolean = False Shared _ReadPort As Boolean = False Public Event Sending(ByVal Done As Boolean) Public Event DataReceived(ByVal Message As String) Public Sub WindowsApplicaton2(ByRef COMMPORT As String) SMSPort = New SerialPort With SMSPort .PortName = COMMPORT .BaudRate = 19200 .Parity = Parity.None .DataBits = 8 .StopBits = StopBits.One .Handshake = Handshake.RequestToSend .DtrEnable = True .RtsEnable = True .NewLine = vbCrLf End With End Sub Public Function ReceiveSMS(ByVal textbox1 As TextBox) As Boolean SMSPort.WriteLine("AT") SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) SMSPort.WriteLine("AT+ CNMI=1,1,0,0,0" & vbCrLf) SMSPort.WriteLine("AT+CMGR= 10" & vbCrLf) textbox1.Text = SMSPort.ReadExisting SMSPort.WriteLine("AT+CMGD=") End Function End Class
My.Computer.Ports.OpenSerialPort
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)