How to Right Justify Standard Numbers in a Masked Edit Field (97141)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q97141 SUMMARY
The Masked edit control does not provide a method to right justify numbers.
Ordinary methods and the Format$ function do not work because the Masked
edit control uses the underscore character to represent blanks in the text
property. For example, if 300 is entered in a Masked edit field with a mask
of #####, the text property would contain "__300" instead of " 300."
However, you can use the technique described in this article to right
justify a Masked edit field using a standard number mask and format. This
is done in three steps:
- Create a string of underscore characters that matches the length of the
mask in the Masked edit control.
- Concatenate the text entered in the Masked edit control to the end of'
the underscore string. This result is a string longer than the mask of
the Masked edit control.
- Use the Right$ function to remove the extra underscore characters from
the beginning of the string.
Modification Type: | Major | Last Reviewed: | 10/30/2003 |
---|
Keywords: | KB97141 |
---|
|