Hi guys, I through this code together from examples I found here but I need help with the bottom line that says "disconect the call" not sure how to handle this part?? I am using a Dell 1501........XP
Thanks!!
Thanks!!
vb.net Code:
'Code from reference sources used: 'http://www.vbforums.com/showthread.php?660753-Listening-to-the-Serial-Port-Need-help&highlight=Modem+As+New+IO.Ports.SerialPort 'http://www.vbforums.com/showthread.php?647989-Get-caller-ID-from-serialport!&highlight=Modem.Write%28AT%2BVCID%3D1+%26amp%3B+vbCrLf%29 'http://code.msdn.microsoft.com/windowsdesktop/SerialPort-Sample-in-VBNET-fb040fb2 Public Class Form1 Private WithEvents SerialPort As New System.IO.Ports.SerialPort Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.CheckForIllegalCrossThreadCalls = False ' <--This will be underlined as error but seems to work OK With SerialPort .PortName = "Com3" 'for example .BaudRate = 9600 .RtsEnable = True 'If SerialPort.IsOpen = False Then SerialPort.Open() 'SerialPort.Write("AT+VCID=1" & vbCrLf) Try .Open() SerialPort.Write("AT+VCID=1" & vbCrLf) Catch ex As Exception End Try End With End Sub Private Sub SerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived Dim DataFromPort As String = SerialPort.ReadExisting RichTextBox1.AppendText(DataFromPort) ' displays formatted caller ID info ' if NAME = UNAVAILABLE then hang up the call If DataFromPort.Contains("UNAVAILABLE") Then 'disconect the call 'SerialPort.Write("AT+??" & vbCrLf) ' <-- not sure what to do here to hang up? End If End Sub End Class