Article ID: 216379 - Last Review: May 13, 2003 - Revision: 2.0 FIX: Visual Basic 6.0 Booleans are Coerced to Localized StringsThis article was previously published under Q216379 On This PageSYMPTOMS
When Boolean constants or variables are concatenated into a string and the Regional Setting is not English, Visual Basic 6.0 coerces the Boolean value to a string containing the text of the value. For example, when the Regional Settings are set to French, you would see the string "Vrai" for True. Unfortunately, "Vrai" will not be converted back to the Boolean True even when CBool is applied. If CBool is applied to the string containing the localized word, a Type Mismatch error occurs.
RESOLUTION
The simplest work around is to apply CStr or Str$ to the Boolean constant or variable before it is coerced into the localized word. For example, in the following sample, the Boolean value True is explicitly converted to a string to retain the English value. The string can then be successfully parsed and converted back to a Boolean value. STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base: 194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why (http://support.microsoft.com/kb/194022/EN-US/ ) 194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed (http://support.microsoft.com/kb/194295/EN-US/ ) MORE INFORMATION
Visual Basic 6.0 coerces Boolean constants and variables to strings containing localized words when Regional Settings are set to a language other than English. Visual Basic 6.0 is unable to convert these localized strings back to their Boolean values.
Steps to Reproduce Behavior
| Article Translations
|
Back to the top
