本文介绍了帮助从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 broadbond回复文本到vb.net应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!