帮助从usb broadbond回复文本到vb.net应用程序 [英] help in reciving text from usb broadbond to vb.net application

查看:80
本文介绍了帮助从usb broadbond回复文本到vb.net应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我这里有接收文字从broadbond到vb.net应用程序的代码这个不完整而且有错误你能给我发一个运行程序到我的电子邮件或完成代码这样做tnx



i have here the code for recieving text from broadbond to vb.net application this is not complete and have errors can you pls send me a runing programme to my email or complete code doing this tnx

Public Class Form1

    Dim inputData As String = ""
    Public Event DataReceived As IO.Ports.SerialDataReceivedEventHandler

    Private Sub Form1_Load(ByVal sender As System.Object, _
                   ByVal e As System.EventArgs) Handles MyBase.Load
        'Set values for some properties
        SerialPort1.PortName = "COM1"
        SerialPort1.BaudRate = 9600
        SerialPort1.Parity = IO.Ports.Parity.None
        SerialPort1.DataBits = 8
        SerialPort1.StopBits = IO.Ports.StopBits.One
        SerialPort1.Handshake = IO.Ports.Handshake.None
        SerialPort1.RtsEnable = True

        ' Open the Serial Port
        SerialPort1.Open()

        'Writes data to the Serial Port output buffer
        If SerialPort1.IsOpen = True Then
            SerialPort1.Write("MicroCommand")
        End If
    End Sub

    ' Receive data from the Serial Port
    Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, _
                      ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
                      Handles SerialPort1.DataReceived
        inputData = SerialPort1.ReadExisting 'or SerialPort1.ReadLine
        Me.Invoke(New EventHandler(AddressOf DoUpdate))
    End Sub

    'Show received data on UI controls and do something
    Public Sub DoUpdate()
        TextBox1.Text = TextBox1.Text & inputData
    End Sub

    Private Sub Form1_FormClosed(ByVal sender As System.Object, _
                   ByVal e As System.Windows.Forms.FormClosedEventArgs) _
                   Handles MyBase.FormClosed
        ' Close the Serial Port
        SerialPort1.Close()
    End Sub

End Class

推荐答案

他想要接收数据来自宽带。我会假设它是一些端口。但无论如何,我猜是USB。 USB不能是COM1。所以基本上他不知道打开哪个端口。程序很好。所有OP需要做的是找出调制解调器或设备连接到哪个端口,并用端口号替换COM1。
He wants to receive data from "broadband". I will assume that it is some port. But in any case it is USB I guess. USB can not be COM1. So basically he does not know which port to open. Program is fine. All OP needs to do is find out which port the modem or the device is connected to and replace COM1 with the port number of that.


这篇关于帮助从usb broadbond回复文本到vb.net应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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