Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42220

VS 2005 Caller ID code (sample included) ....but I need help!

$
0
0
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!!

vb.net Code:
  1. 'Code from reference sources used:
  2. 'http://www.vbforums.com/showthread.php?660753-Listening-to-the-Serial-Port-Need-help&highlight=Modem+As+New+IO.Ports.SerialPort
  3. 'http://www.vbforums.com/showthread.php?647989-Get-caller-ID-from-serialport!&highlight=Modem.Write%28AT%2BVCID%3D1+%26amp%3B+vbCrLf%29
  4. 'http://code.msdn.microsoft.com/windowsdesktop/SerialPort-Sample-in-VBNET-fb040fb2
  5.  
  6. Public Class Form1
  7.  
  8.     Private WithEvents SerialPort As New System.IO.Ports.SerialPort
  9.  
  10.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11.  
  12.         Me.CheckForIllegalCrossThreadCalls = False ' <--This will be underlined as error but seems to work OK
  13.  
  14.         With SerialPort
  15.  
  16.             .PortName = "Com3"   'for example
  17.             .BaudRate = 9600
  18.             .RtsEnable = True
  19.  
  20.             'If SerialPort.IsOpen = False Then SerialPort.Open()
  21.             'SerialPort.Write("AT+VCID=1" & vbCrLf)
  22.  
  23.             Try
  24.                 .Open()
  25.                 SerialPort.Write("AT+VCID=1" & vbCrLf)
  26.  
  27.             Catch ex As Exception
  28.  
  29.             End Try
  30.  
  31.  
  32.         End With
  33.  
  34.     End Sub
  35.  
  36.  
  37.     Private Sub SerialPort_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort.DataReceived
  38.  
  39.         Dim DataFromPort As String = SerialPort.ReadExisting
  40.  
  41.         RichTextBox1.AppendText(DataFromPort) ' displays formatted caller ID info
  42.  
  43.         ' if NAME = UNAVAILABLE    then hang up the call
  44.  
  45.         If DataFromPort.Contains("UNAVAILABLE") Then
  46.  
  47.             'disconect the call
  48.             'SerialPort.Write("AT+??" & vbCrLf) ' <-- not sure what to do here to hang up?
  49.  
  50.         End If
  51.  
  52.     End Sub
  53.  
  54. End Class

Viewing all articles
Browse latest Browse all 42220

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>