DOCUMENT:Q195631 12-NOV-1998 [vbwin] TITLE :PRB: Effects of Operating System Version On TextBox Alignment PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0,6.0 OPER/SYS:WINDOWS KEYWORDS:kbVBp kbVBp500 kbVBp600 kbEditCtrl ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 6.0 - Microsoft Visual Basic Control Creation, Learning, Professional, and Enterprise Editions for Windows, version 5.0 --------------------------------------------------------------------- SYMPTOMS ======== The value of the "Alignment" property of a TextBox control is ignored and the default of "left aligned" is applied on some systems. The same application installed on other systems does not exhibit this behavior. CAUSE ===== Visual Basic derives its TextBox control from a proprietary class called "ThunderTextBox," which in turn is based on the "Edit" class provided by the operating system. Because the operating system defines the "Edit" class, some of the properties and functionality of a TextBox may change depending upon the version of the operating system where the application is executed. This is the case with the TextBox's Alignment property. In earlier versions of Windows, changes to the "Alignment" property would not take effect unless the "MultiLine" property of the TextBox was set to "True." The latest versions of the Windows operating system no longer have this limitation. Any control from any development environment that is derived from the "Edit" class will demonstrate the same change in behavior. Versions of Windows that require the "MultiLine" property to be set to "True" in order for the "Alignment" property to take effect include: Windows 95 (regardless of service packs) Windows NT 3.51 (regardless of service packs) Windows NT 4.0 Windows NT 4.0 with Service Packs 1 or 2 Versions of Windows that do not have this requirement include: Windows 98 Windows NT 4.0 with Service Pack 3 or higher RESOLUTION ========== There are two approaches for working around this inconsistency: - Assume the older operating system limitation is being enforced and set the TextBox control's "MultiLine" property to "True." - Use multiple overlapping TextBox controls and vary which one is visible depending on the operating system in use (checked via API) and the alignment desired. STATUS ====== This behavior is by design. REFERENCES ========== For additional information, please see the following articles in the Microsoft Knowledge Base: ARTICLE-ID: Q189249 TITLE : HOWTO: Determine Which 32-Bit Windows Version Is Being Used ARTICLE-ID: Q111952 TITLE : HOWTO: Right Justify/Center Text in Single-Line Text Control Additional query words: ====================================================================== Keywords : kbVBp kbVBp500 kbVBp600 kbEditCtrl Version : WINDOWS:5.0,6.0 Platform : WINDOWS Issue type : kbprb ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.