Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If SerialPort1.IsOpen = False Then MsgBox("Port not Open!!") Exit Sub End If If Me.TxtTo.Text = "" Then MsgBox("All fields are required!!") Exit Sub End If If Me.TxtSMS.Text = "" Then MsgBox("All fields are required!!") Exit Sub End If With SerialPort1 .ReceivedBytesThreshold = 1 .DtrEnable = True ' Send an 'AT' command to the phone .Write("AT" & vbCrLf) .Write("AT+CMGF=1" & vbCrLf) 'This line can be removed if your modem will always be in Text Mode... .Write("AT+CMGS=" & Chr(34) & TxtTo.Text & Chr(34) & vbCrLf) 'ok here .Write(TxtSMS.Text & Chr(26)) ' .ReceivedBytesThreshold = 0 .DtrEnable = False End With ' SaveToSent() End Sub