Interesting note, the code below as is will attempt to cast what is clearly
indicated as a string into a double. This is becuase the use of + as a
concatenation operator. The error message generated is included with the
code. Use & instead and it works.
Dim pstrSend As String = ""
'ActionCode 1 and 2 are type BYTE, Msg is a byVal string parameter
pstrSend = Chr(ActionCode1 ) + Chr(ActionCode2 ) + Msg + &HFF & vbCr
'write and flush
objSocketWriter .Write(pstrSend )
objSocketWriter .Flush()
End Function
An unhandled exception of type 'System.Invalid CastException' occurred in
microsoft.visua lbasic.dll
Additional information: Cast from string "cThis is a longer test message" to
type 'Double' is not valid.
System.InvalidC astException: Cast from string "cThis is a longer test
message" to type 'Double' is not valid. ---> System.FormatEx ception: Input
string was not in a correct format.
indicated as a string into a double. This is becuase the use of + as a
concatenation operator. The error message generated is included with the
code. Use & instead and it works.
Dim pstrSend As String = ""
'ActionCode 1 and 2 are type BYTE, Msg is a byVal string parameter
pstrSend = Chr(ActionCode1 ) + Chr(ActionCode2 ) + Msg + &HFF & vbCr
'write and flush
objSocketWriter .Write(pstrSend )
objSocketWriter .Flush()
End Function
An unhandled exception of type 'System.Invalid CastException' occurred in
microsoft.visua lbasic.dll
Additional information: Cast from string "cThis is a longer test message" to
type 'Double' is not valid.
System.InvalidC astException: Cast from string "cThis is a longer test
message" to type 'Double' is not valid. ---> System.FormatEx ception: Input
string was not in a correct format.
Comment