Click here to Skip to main content
15,911,039 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralData Environments Pin
Derek Lakin12-Jun-02 21:52
Derek Lakin12-Jun-02 21:52 
GeneralRe: Data Environments Pin
Derek Lakin13-Jun-02 1:22
Derek Lakin13-Jun-02 1:22 
GeneralExcel Macro Pin
Ian12-Jun-02 21:13
Ian12-Jun-02 21:13 
General.NET SaveFileDialog bug Pin
12-Jun-02 19:15
suss12-Jun-02 19:15 
GeneralCAPICOM Pin
estebanf12-Jun-02 11:42
estebanf12-Jun-02 11:42 
GeneralInternet Options Pin
12-Jun-02 3:37
suss12-Jun-02 3:37 
GeneralRe: Internet Options Pin
Ghazi H. Wadi18-Jun-02 22:04
Ghazi H. Wadi18-Jun-02 22:04 
GeneralBuilding Char Strings, Chars ASCII > 127 & Chinese Windows Pin
Jason Teagle11-Jun-02 23:31
Jason Teagle11-Jun-02 23:31 
An app (VB) that we have had running for a few years now has been working fine on American and European versions of Windows. Now someone has tried to run it on Chinese Windows, and it's not working. I have traced it down to one specific thing, as follows:

The code builds up Modbus communications messages one byte at a time using VB's Chr$() function, like this:

strMessage = Chr$(1) & Chr$(3) & Chr$(0) & Chr$(48) ... etc.

Now, as we all know an unsigned byte can be from 0 - 255. Also, in a single byte character system, ASCII characters also go from 0 to 255. Thus, it is quite natural to want to add such bytes beyond 127, which would be negative values _if_treated_as_signed_bytes_:

strMessage = strMessage & Chr$(245) & Chr$(136)

Now, on most systems this works just dandy. But I have discovered that whenever we try to add a byte (character) > 127 under Chinese Windows, it instead ends up with 0 there - it doesn't seem to get it right.

All suspicions point to MBCS (multi-byte character set) issues, but I was under the impression that VB handles this automatically.

Can anyone suggest how I might successfully add bytes > 127 to a VB string, using VB methods? When I get totally desperate I can call to a C++ DLL to do it, but there's a fair bit of work rewriting the VB code for that so it's a very last resort!

--
Jason Teagle
jason@teagster.co.uk
-----------------------------------------------------------
A list of programming resources I use:
ML: www.windev.org, www.codecipher.com, www.beginthread.com
MB: www.codeguru.com, www.codeproject.com
NG: comp.lang.java.*
OI: www.php.net
-----------------------------------------------------------

GeneralRe: Building Char Strings, Chars ASCII > 127 & Chinese Windows Pin
Jason Teagle12-Jun-02 1:17
Jason Teagle12-Jun-02 1:17 
GeneralSafearray in VB Pin
Hans Ruck11-Jun-02 23:07
Hans Ruck11-Jun-02 23:07 
GeneralRe: Safearray in VB Pin
Ghazi H. Wadi18-Jun-02 22:16
Ghazi H. Wadi18-Jun-02 22:16 
Questionhow to make a trial software Pin
11-Jun-02 4:37
suss11-Jun-02 4:37 
AnswerRe: how to make a trial software Pin
SimonS11-Jun-02 6:10
SimonS11-Jun-02 6:10 
GeneralRe: how to make a trial software Pin
adol11-Jun-02 6:30
adol11-Jun-02 6:30 
AnswerRe: how to make a trial software Pin
Nick Parker11-Jun-02 18:05
protectorNick Parker11-Jun-02 18:05 
GeneralRe: how to make a trial software Pin
13-Jun-02 5:03
suss13-Jun-02 5:03 
GeneralRe: how to make a trial software Pin
SHaroz13-Jun-02 6:51
SHaroz13-Jun-02 6:51 
GeneralRe: how to make a trial software Pin
Nick Parker13-Jun-02 8:32
protectorNick Parker13-Jun-02 8:32 
GeneralCursor Question Pin
Nick Parker7-Jun-02 10:35
protectorNick Parker7-Jun-02 10:35 
GeneralRe: Cursor Question Pin
Jeremy Falcon11-Jun-02 5:22
professionalJeremy Falcon11-Jun-02 5:22 
GeneralRe: Cursor Question Pin
Nick Parker11-Jun-02 5:16
protectorNick Parker11-Jun-02 5:16 
GeneralRe: Cursor Question Pin
Jeremy Falcon11-Jun-02 5:54
professionalJeremy Falcon11-Jun-02 5:54 
GeneralRe: Cursor Question Pin
Nick Parker11-Jun-02 5:51
protectorNick Parker11-Jun-02 5:51 
GeneralWord Macro Pin
laphijia7-Jun-02 7:44
laphijia7-Jun-02 7:44 
GeneralRe: Word Macro Pin
Rama Krishna Vavilala7-Jun-02 7:48
Rama Krishna Vavilala7-Jun-02 7:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.