PRB: Grid Control's Cell Blank When Using Str$ (80904)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 2.0
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 2.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
- Microsoft Visual Basic Standard Edition for Windows 1.0
This article was previously published under Q80904 SYMPTOMS
With the Microsoft Professional Toolkit for Visual Basic Grid control,
when you use the Str$ function to store numeric values in a grid cell,
the cell appears blank if it is not wide enough to completely display
the value.
CAUSE
This behavior occurs because of word wrapping. The Str$ function
returns a string that begins with a space character. When this string
does not fit in a grid cell, it wraps to the next line, breaking on
the leading space so that no text remains on the first line of the cell.
WORKAROUND
To avoid the problem, use Format$ instead of Str$, or Ltrim$ with Str$. To
work around the problem, change the assignment to Grid1.Text to one of the
following:
Grid1.Text = Format$(123456)
Grid1.Text = Ltrim$(Str$(123456))
This will eliminate the leading space, and the information in the cell
will be displayed up to the width of the cell. You can also increase
the width of the cell to allow all characters to be visible.
Modification Type: | Major | Last Reviewed: | 12/12/2003 |
---|
Keywords: | kbprb KB80904 |
---|
|