Assistance Required with VB.net


Results 1 to 33 of 33

Threaded View

  1. #12
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I'm trying to send data from PIC - PC using the program mackrackit pointed to earlier in this thread.

    http://www.rentron.com/receiving_data.htm

    When I compile it I have this error message: Name 'comEvReceive' is not declared.

    Does anyone have an idea of a fix (with as much of an explaination as you can spare please, I'm new to this). I've done lots of Googling with various answer from 'Select Case' to it can't be done in the 2008 VB-Version.

    Code:
     Private Sub MSComm1_OnComm()
    Dim sData As String ' Holds our incoming data
    Dim lHighByte As Long   ' Holds HighByte value
    Dim lLowByte As Long    ' Holds LowByte value
    Dim lWord As Long       ' Holds the Word result
    
    ' If comEvReceive Event then get data and display
    If MSComm1.CommEvent = comEvReceive Then
    
        sData = MSComm1.Input ' Get data (2 bytes)
        lHighByte = Asc(Mid$(sData, 1, 1)) ' get 1st byte
        lLowByte = Asc(Mid$(sData, 2, 1))  ' Get 2nd byte
        
        ' Combine bytes into a word
        lWord = (lHighByte * &H100) Or lLowByte
        
        ' Convert value to a string and display
        lblRCTime.Caption = CStr(lWord)
        
    End If
    End Sub
    I guess I should add I'm using Visual Basic 2008 Express Edition.

    Any help much appreciated.

    Dave
    Last edited by LEDave; - 27th August 2010 at 17:13.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts