Click here to Skip to main content
15,914,160 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am not expert in Visual Basic coding and I need to store data from hyper terminal into some files.
For that I need API which is read data from hyper terminal and store somewhere in file.

Any help for me can be appreciated.
Thanks!
Posted

1 solution

Hi

Follow of these code you can open port and read data from Hyper Terminal:

VB
Option Explicit
Private Buffer As String

Private Sub Form_Load()
MSComm1.CommPort = 3
MSComm1.Settings = "9600,N,8,1"

        If MSComm1.PortOpen Then
            MSComm1.RThreshold = 1
            MSComm1.InputLen = 1
            MSComm1.CommPort = 1
            If Not MSComm1.PortOpen Then 
	        MSComm1.PortOpen = True
            Else
                MsgBox "Warrning!:fail to open port."
            End If
        End If
End Sub

Private Sub MSComm1_OnComm()
    Select Case MSComm1.CommEvent
    Case comEvReceive
        Buffer = MSComm1.Input
        MyParser
    End Select
End Sub

Private Sub MyParser()
    Do While Len(Buffer) <> 0
        Text1.Text = Text1.Text & ""
        IF MSComm1.InBufferCount > 0 Then 
            Buffer = Buffer & MSComm1.Input
        End IF
    Loop
End Sub


Additionally you can use this link http://msdn.microsoft.com/en-us/library/aa168292(v=office.11).aspx[^] for write your data from Excel file and you can download example of Mscomm follow of this link http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=7585&lngWId=1[^] ;)

Best Regards.
 
Share this answer
 
v4

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



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