jeroen684
Nov 20th, 2007, 10:48 AM
Hi all,
I´m sending data to the PC from an embedded application. The data contains a string (node name, MAC address) and some user data. The string contains only ascii characters, but the data can be anything from 0 to 0xFF (255). I have been converting the string to a variable (int) in VB by doing Asc(mid(strData, 19,1)) which works fine in Germany. But, if the codepage is different it doesn´t work anymore, all sorts of strange things happen. I even get the wrong value from Len(strData) somehow. e.g. in:
Private Sub wsRunning_DataArrival(ByVal bytesTotal As Long)
On Error GoTo error
wsRunning.GetData strData, vbString
Now bytesTotal is 43 (which is the amount of bytes sent, so correct), but Len(strData) returns 42..... possibly because of illegal characters?
Anyway, I am freaked by this... I tried CInt(Mid(strData,18,1)) but only get type mismatch errors..... help!!!!
thanks... any suggestions would be greatly appreciated!
I´m sending data to the PC from an embedded application. The data contains a string (node name, MAC address) and some user data. The string contains only ascii characters, but the data can be anything from 0 to 0xFF (255). I have been converting the string to a variable (int) in VB by doing Asc(mid(strData, 19,1)) which works fine in Germany. But, if the codepage is different it doesn´t work anymore, all sorts of strange things happen. I even get the wrong value from Len(strData) somehow. e.g. in:
Private Sub wsRunning_DataArrival(ByVal bytesTotal As Long)
On Error GoTo error
wsRunning.GetData strData, vbString
Now bytesTotal is 43 (which is the amount of bytes sent, so correct), but Len(strData) returns 42..... possibly because of illegal characters?
Anyway, I am freaked by this... I tried CInt(Mid(strData,18,1)) but only get type mismatch errors..... help!!!!
thanks... any suggestions would be greatly appreciated!