Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Problem calling comEvReceive in NetComm.ocx

Problem calling comEvReceive in NetComm.ocx

Scheduled Pinned Locked Moved Visual Basic
helpcsharptestingbeta-testing
1 Posts 1 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lax
    wrote on last edited by
    #1

    I have downloaded NetComm.ocx (Active-X control for MSComm control in .NET) and run its sample program successfully. However, I could not call the comEvReceive event when I send a message to my modem using AT commands. Any help or advice is greatly appreciated !! =) Below is my code snippet : Private Sub frmSMS_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load NETComm1.CommPort = 3 NETComm1.set_Settings("115200" & "," & "N" & "," & "7" & "," & "1") NETComm1.Handshaking = NETCommOCX.HandshakeConstants.comNone NETComm1.InputLen = 0 NETComm1.RThreshold = 1 NETComm1.SThreshold = 0 NETComm1.PortOpen = True NETComm1.DTREnable = True MsgBox(NETComm1.CDHolding) MsgBox(NETComm1.CTSHolding) MsgBox(NETComm1.DSRHolding) End Sub Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click Dim strAT, strATTxt, strATSend As String 'Dim busy As Boolean 'strAT = "a" strAT = "AT" & vbCr & vbLf SendMsg(strAT) '-- Select Text Mode 'strATTxt = "AT+CMGF=1" & vbCr 'Call SendMsg(strATTxt) '-- Send Message 'strATSend = "AT+CMGS=96820277" & vbCr 'Call SendMsg(strATSend) 'strATMsg = "Testing from VB" & vbCr 'Call SendMsg(strATMsg) 'busy = True 'Do While busy 'System.Windows.Forms.Application.DoEvents() 'Loop End Sub Private Sub SendMsg(ByRef msg As String) Dim n As Integer If NETComm1.PortOpen Then NETComm1.set_Output(msg) End If End Sub Private Sub NETComm1_OnComm(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NETComm1.OnComm Static EVMsg As String Static ERMsg As String Static Ret As Short '--- Branch according to the CommEvent Prop.. Select Case NETComm1.CommEvent '--- Event messages Case MSCommLib.OnCommConstants.comEvReceive Dim Buffer As VariantType MsgBox(NETComm1.InputData) Buffer = NETComm1.InputData If InStr(Buffer, " OK ") > 0 Then MsgBox(Buffer) End If Case MSCommLib.OnCommConstants.comEvCTS EVMsg = "Change in CTS Detected" Case MSCommLib.OnCommConstants.comE

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups