本文介绍了由于线程退出或应用程序请求,i / o操作已中止。串行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 Private Sub SerialPort1_DataReceived(sender As Object, e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived Dim bytRxBuff(CurrentUserRqst.iRcvLength) As Byte Dim iRcvdLength As Integer = SerialPort1.Read(bytRxBuff, 0, CurrentUserRqst.iRcvLength) SerialPort1.DiscardInBuffer() SerialPort1.DiscardOutBuffer() 'Debug.EvaluateStatement(iRcvdLength) 'Cls_Error.WriteToErrorLog(iRcvdLength.ToString, iRcvdLength.ToString, "Error") ProcessFrame(bytRxBuff, iRcvdLength) End Sub Private Sub Send_Frame(ByVal bytFrame As Byte(), ByVal iRcvLength As Integer) If bytFrame(1) = &HC Then SerialPort1.ReceivedBytesThreshold = 7 Else SerialPort1.ReceivedBytesThreshold = iRcvLength End If If SerialPort1.IsOpen Then SerialPort1.Write(bytFrame, 0, bytFrame.Length) End If System.Threading.Thread.Sleep(100) End Sub Private Sub LatestDownload_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed If SerialPort1.IsOpen Then 'SerialPort1.DataReceived -= Receive SerialPort1.DiscardInBuffer() SerialPort1.DiscardOutBuffer() SerialPort1.Close() End If End Sub 我关闭表格的地方会给出错误 由于线程退出或应用程序请求,i / o操作已中止。 serial Where i close my form den it will give an errorthe i/o operation has been aborted because of either a thread exit or an application request. serial推荐答案 这篇关于由于线程退出或应用程序请求,i / o操作已中止。串行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-12 16:29