Joke Collection Website - Blessing messages - Vb.net hangs when the serial port is closed.
Vb.net hangs when the serial port is closed.
Private? Sub? MyCOMM_DataReceived(ByVal? Sender? As? Object? ByVal? e? As?
System. IO . ports . serial datareceivedeventargs)? Handle? MyCOMM。 Data reception
What if? IsClosing? then what Quit Sub? If the interface is shutting down the serial port, exit the process.
attempt
IsListenning? =? True' sets the label being read to be judged by the interface operation.
Wait (150)' Wait150ms.
Dim? n? As? Dragon? =? MyCOMM。 Byte reading
Dim? buf(n? -? 1)? As? byte
attempt
MyCOMM。 Read (buf,? 0,? n)
Catch? Former? As? exception
MsgBox ("Error in receiving SMS", "Behave appropriately. Data reception ")
Throw? New? System. Exceptions (such as messages)
finally
IsListenning? =? "False" turns off the tag being read, regardless of whether the data is successfully received.
End? attempt
MyCOMM。 Close ()
MyCOMM。 Open ()
Do what? something
Catch? Former? As? exception
MyCOMM。 Close ()
MyCOMM。 Open ()
End? attempt
End? submarine
Protected? Sub? Wait (ByVal? Milliseconds As? Integer)
Dim? tmpNow? As? Dating? =? at present
What time? Now Subtract (tmpNow). Milliseconds & lt? millisecond
Apply. DoEvents()
End? During ...
End? Sub hopes to help.
- Previous article:New Year greetings from China
- Next article:Short message number sent to Tibet
- Related articles
- My mobile phone text message stopped in the middle of the sound.
- Can't I send text messages on my mobile phone? These methods help you solve it!
- A farewell message for the leader's promotion
- Is the transfer information sent by WeChat friends circle a fraud?
- Wechat account is frozen, how to unlock it?
- Today, I received the travel accident-free protection plan C from Pacific Insurance, issued by10655021955003032. The policy number is121106557425. Is it a lie?
- A mobile phone message, help me guess .. Send me the answer .. Thanks.
- Why is there a missing paragraph in the short message record sent by the bank?
- How is the public security in Penglai?
- Please help me check the number of +86 1587 1903062 and keep sending me spam messages.