Click here to Skip to main content
15,883,996 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim str As String

Private Sub send_Click()
    Dim str As String
    MSComm1.Output = Text1.Text & str
    Do
        DoEvents
            Loop Until MSComm1.InBufferCount >= 2
            str = MSComm1.Input
            Text2.Text = str
            MSComm1.PortOpen = False
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
    MSComm1.Output = KeyAscii
    Text1.Text = KeyAscii
End Sub

Private Sub Form_Load()

    MSComm1.CommPort = 3
    MSComm1.Settings = "9600,N,8,1"
    MSComm1.InputLen = 0
    MSComm1.PortOpen = True
    
End Sub

Private Sub MSComm1_OnComm()

    MSComm1.CommPort = 3
    MSComm1.Settings = "9600,N,8,1"
    MSComm1.PortOpen = True
    If MSComm1.InBufferCount Then
        InStr$ = MSComm1.Input
    End If
    MSComm1.InBufferSize = 1024
    MSComm1.InBufferCount = 0
    MSComm1.OutBufferSize = 512
    MSComm1.OutBufferCount = 0
    MSComm1.Break = True
    MSComm1.DSRHolding = True
    MSComm1.DTREnable = True
    Select Case MSComm1.CommEvent
        Case comBreak
            MsgBox ("Break Received")
        Case comCDTO
        Case comCTSTO
        Case comDSRTO
        Case comFrame
        Case comOverrun
        Case comRxOver
        Case comRxParity
        Case comTxFull
        Case comEvCD
        Case comEvCTS
        Case comEvDSR
        Case comEvRing
        Case comEvReceive
            Text2.Text = MSComm1.Input
        Case comEvSend
    End Select
End Sub


What I have tried:

Till yesterday my program was working and today morning when i opened my project in VB6 and again compiled my program and got this error "type-declaration character does not match declared data type"

Please help me
Posted
Updated 16-Oct-17 21:15pm
v2
Comments
Richard Deeming 17-Oct-17 12:57pm    
Where is the InStr variable declared, and what type is it declared as?

1 solution

You know, the compiler locates and reports the offending line.
You shoud report here the exact error message.

Quote:
Till yesterday my program was working and today morning when i opened my project in VB6 and again compiled my program and got this error
That's very strange. Did you possibly introduce a typo after reopening the project?
 
Share this answer
 
Comments
Member 13396059 17-Oct-17 7:14am    
InStr$ = MSComm1.Input at this line i was getting error at InStr$

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900