Question Serial Data reception error

softhard

Active member
Joined
Sep 29, 2012
Messages
35
Programming Experience
Beginner
Hello,
I have written some code to receive the serial data in proper way. Everything seems working but somtimes i got this exception which i neither understand. I have explictly specified the length as 1 in Mid function. However, still the exception arises due to length less than zero which is set to one:upset:.

where i am doning wrong with this error.
 

Attachments

  • namnlös.JPG
    namnlös.JPG
    104.1 KB · Views: 28
VB.NET:
Public Shared Function Mid( _
   ByVal str As String, _
   ByVal Start As Integer, _
   Optional ByVal Length As Integer _
) As String

Public Overloads Function Asc(ByVal String As String) As Integer

Public Shared Function ToInt16 ( _
	value As String _
) As Short
Based on these declarations I would say the argument 'String' refers to the the Asc function. So in this case your Mid call return a 0-length string, which can't be passed as argument to the Asc function.
 
Back
Top