Hello,
I use a ListView control (report view) to show the user a summary of error
messages. The width of the column that holds the error messages is such that
no horizontal scrollbar is needed. However, in some cases, the length of the
error message text is wider than the width of the column. In this case, the
text is hyphened with three dots.
I want to check the width of the error message text and if necessary,
increase the width of the ListView column. By trial and error, I know that
the amount of text that fits in a column of width 5620 twips is exactly
"XXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXX".
So, I created the following piece of code (the string Message holds a
certain error message):
With Printer
If .TextWidth(Mess age) >
..TextWidth("XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XX") Then
ListView1.Colum nHeaders.Item(3 ).Width = .TextWidth(Mess age) /
..TextWidth("XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XX") * 5620
End If
End With
Although this code functions properly, I don't think it's an outstanding
solution. Does somebody knows a better piece of code?
Thanks in advance,
Geert-Pieter
I use a ListView control (report view) to show the user a summary of error
messages. The width of the column that holds the error messages is such that
no horizontal scrollbar is needed. However, in some cases, the length of the
error message text is wider than the width of the column. In this case, the
text is hyphened with three dots.
I want to check the width of the error message text and if necessary,
increase the width of the ListView column. By trial and error, I know that
the amount of text that fits in a column of width 5620 twips is exactly
"XXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXX".
So, I created the following piece of code (the string Message holds a
certain error message):
With Printer
If .TextWidth(Mess age) >
..TextWidth("XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XX") Then
ListView1.Colum nHeaders.Item(3 ).Width = .TextWidth(Mess age) /
..TextWidth("XX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XX") * 5620
End If
End With
Although this code functions properly, I don't think it's an outstanding
solution. Does somebody knows a better piece of code?
Thanks in advance,
Geert-Pieter
Comment