ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with ListItem Width (https://www.excelbanter.com/excel-programming/365843-problem-listitem-width.html)

allenj3

Problem with ListItem Width
 
I am working with a listview control under the .view = lvwReport setting. I
add one column header and set the column width to 200. When I add a listitem
to the listview, the width of the listitem is well under 200 and is not
displaying the entire text of the listitem. The following is an example of
the code I'm using...

Dim LV As ListItem
Dim strLabel

Set LV = Userform1.ListView1
LV.ColumnHeaders.Add 1, , "", 200
strLabel = "Concept Test"

LV.ListItems.Add 1,,strLabel

The listitem appears under the first (and only) column header as "Concept
Te..." instead of the full text and the listitem.width property equals 54.
Why is the columnheader width equal to 200 yet the listitem.width is only
equal 54 (and less than the necessary length to capture the entire text)?
Also frustrating is the fact that the listitem.width property is read-only.

Thanks in advance for any help!

Jay

allenj3

Problem with ListItem Width
 
I seem to have partially answered my own question. If I set the
listview.fullrowselect property to True, the entire text gets displayed.
Still not sure why this was happening, but I've got code that works now.

Thanks.

"allenj3" wrote:

I am working with a listview control under the .view = lvwReport setting. I
add one column header and set the column width to 200. When I add a listitem
to the listview, the width of the listitem is well under 200 and is not
displaying the entire text of the listitem. The following is an example of
the code I'm using...

Dim LV As ListItem
Dim strLabel

Set LV = Userform1.ListView1
LV.ColumnHeaders.Add 1, , "", 200
strLabel = "Concept Test"

LV.ListItems.Add 1,,strLabel

The listitem appears under the first (and only) column header as "Concept
Te..." instead of the full text and the listitem.width property equals 54.
Why is the columnheader width equal to 200 yet the listitem.width is only
equal 54 (and less than the necessary length to capture the entire text)?
Also frustrating is the fact that the listitem.width property is read-only.

Thanks in advance for any help!

Jay



All times are GMT +1. The time now is 03:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com