Hi guys! Badly need your help. I'm working on a project in VB.net that will enable my application from sending SMS. I already have the code but I'm getting an error which is "The port 'COM15' does not exist." I've tried to search this error in google but it didn't help at all. Thanks in advance for your help.
Imports System.IO.Ports
Public Class Form1
Dim SerialPort1 As New System.IO.Ports.SerialPort()
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
SerialPort1.PortName = "COM15"
SerialPort1.BaudRate = 9600
SerialPort1.Parity = Parity.None
SerialPort1.StopBits = StopBits.One
SerialPort1.DataBits = 8
SerialPort1.Handshake = Handshake.RequestToSend
SerialPort1.DtrEnable = True
SerialPort1.RtsEnable = True
SerialPort1.NewLine = vbCrLf
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim message As String
message = RichTextBox1.Text
SerialPort1.Open()
If SerialPort1.IsOpen() Then
SerialPort1.Write("AT" & vbCrLf)
SerialPort1.Write("AT+CMGF=1" & vbCrLf)
SerialPort1.Write("AT+CMGS=" & Chr(34) & TextBox1.Text & Chr(34) & vbCrLf)
SerialPort1.Write(message & Chr(26))
MsgBox("Sent")
Else
MsgBox("Port not available")
End If
End Sub
End Class