如何从超级终端获取文本数据并存储到excel文件或访问数据库? [英] How to get text data from hyper terminal and store into excel file or access database?

查看:289
本文介绍了如何从超级终端获取文本数据并存储到excel文件或访问数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是Visual Basic编码的专家,我需要将来自超级终端的数据存储到一些文件中。

为此我需要API,它是从超级终端读取数据并存储在某处的文件。



对我的任何帮助都不胜感激。

谢谢!

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!

推荐答案

您好



按照这些代码,您可以打开端口并从超级终端读取数据:



Hi

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

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





另外你可以使用这个链接 http://msdn.microsoft.com/en-us/library/aa168292(v = office.11​​).aspx [ ^ ]用于从Excel文件中写入数据,您可以下载Mscomm的示例链接 http://www.planet-source-code.com /vb/scripts/ShowCode.asp?txtCodeId=7585&lngWId=1 [ ^ ];)



最好的问候。



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.


这篇关于如何从超级终端获取文本数据并存储到excel文件或访问数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆