BUG: First ListItem Truncated with ListView in Report View
Article ID: 149320
Article Last Modified on 6/28/2004
APPLIES TO
- Microsoft Visual Basic 4.0 Standard Edition
- Microsoft Visual Basic 4.0 Professional Edition
- Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
This article was previously published under Q149320
SYMPTOMS
If the first item added to a ListView control set to Report view mode is
added outside of the Form_Load event, the text of that item can be
truncated and not displayed completely. Subsequent ListItem objects added
to the ListView display their text correctly. The problem does not occur if
the text of the ListItem object is specified with the Add method of the
ListItem collection instead of as a separate property assignment.
Another article detailing a somewhat similar problem with the ListView in
Report, rather than List, view mode is article
149264, "BUG: ListView in
Report View Truncates First ListItem." This article outlines the different
symptoms of that problem in addition to a different workaround.
WORKAROUND
This problem can be avoided in two ways:
- Add the initial ListItem to the ListView during the Form_Load event
rather than adding at a later time.
-or-
- Specify the text of the initial ListItem in the Add method of the
ListItem collection object instead of as a separate property assignment.
For example, instead of using this code (assuming lv is a ListItem
object)
Set lv = ListView1.ListItems.Add
lv.Text = "This is the string"
use:
Set lv = listview1.ListItems.Add(, , "This is the string")
Any strings added after the initial item can be added in any manner from
any where in code.
STATUS
Microsoft has confirmed this to be an issue in the Microsoft products
listed at the beginning of this article. Microsoft is researching this
problem and will post new information here in the Microsoft Knowledge Base
as it becomes available.
Additional query words: 4.00 vb4win vb432
Keywords: kbbug KB149320