OnCOmm event does not trigger.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Boomeral
    New Member
    • Nov 2009
    • 1

    OnCOmm event does not trigger.

    I have a basic program to test key click and reception of data on RS232 port. Computer1 is running this program and computer2 is running hyperterminal. When I send the data out from computer1, i can see the data on computer2; however, no onComm event triggers when data is received. KeyClick does not work either.
    Does anyone know what needs to be modified?

    Thanks in advance.
    Boomer

    --------------------------CODE---------------------------------
    Code:
    Imports MSCommLib.OnCommConstants
    
    Public Class Form1
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            AxMSComm1.CommPort = 1 ' Use COM1.
            AxMSComm1.Settings = "9600,N,8,1" ' 9600 baud, no parity, 8 data,
            ' and 1 stop bit.
            AxMSComm1.InputLen = 0 ' Read entire buffer when Input
            ' is used
            AxMSComm1.PortOpen = True ' Open port
        End Sub
        Private Sub Form1_KeyPress(ByVal KeyAscii As Integer)
            AxMSComm1.Output = KeyAscii
            TextBox1.Text = KeyAscii
            AxMSComm1.Output = "This is tested"
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            End
        End Sub
    
        Private Sub AxMSComm1_OnComm(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AxMSComm1.OnComm
            If (AxMSComm1.CommEvent = comEvReceive) Then
                TextBox2.Text = AxMSComm1.Input
            End If
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            AxMSComm1.Output = "This is tested \n \r "
            'Dim inputt As String
            'While (1)
            '    inputt = AxMSComm1.Input
            'End While
    
        End Sub
    End Class
    Last edited by debasisdas; Nov 19 '09, 04:17 AM. Reason: Formatted using code tags.
Working...