|
-
Aug 10th, 2006, 05:02 PM
#1
Thread Starter
Member
ListView Control...
Hi,
I'm trying to use the listview control to display a list of items, as a list, but after 18 characters or so, it keeps going like this:
12345678910abc...
12345678910abc...
12345678910abc...
And wont display the full string, but just three trailing dots to indicate that there's more. Is there anyway of displaying the entire text in a row? Rather than all the rows being a fixed width?
I need to use a listview, rather than a listbox, as I intend in formatting the colour of texts etc which I understand isn't possible in a standard listbox.
Thanks
Snowblind
-
Aug 10th, 2006, 05:06 PM
#2
Re: ListView Control...
Use the Report view and then set the width of the ColumnHeaders.
-
Aug 10th, 2006, 05:06 PM
#3
Thread Starter
Member
Re: ListView Control...
Having just looked at something, if you click the command button twice, it does display the results sort of how I'd like them to, but you get two sets of results then!
-
Aug 10th, 2006, 05:07 PM
#4
-
Aug 10th, 2006, 05:13 PM
#5
Re: ListView Control...
Something... is called wrap. Post the code.
EDIT: Or project.
-
Aug 10th, 2006, 05:33 PM
#6
Thread Starter
Member
Re: ListView Control...
VB Code:
Private Sub Form_Load()
ListView1.ListItems.Add , , "ThisIsALongStringOfTextThatDoesntFit"
ListView1.ListItems.Add , , "ThisIsANOTHERLongStringOfTextThatDoesntFit"
ListView1.ListItems.Add , , "ThisIsYETANOTHERLongStringOfTextThatDoesntFit"
End Sub
Obviously windows common controls have been added to allow for the Listview, and the view is set to lvwlist... I did try the previous advice, setting it to report, but couldn't figure out how to set the column headers. If I can't get this to work, I might have to use a rich text box, but that'd be a bit lame, as I'd rather have it in a list box, for ease of finding, and for row select etc.
Thanks for all your help,
Ammendment:
As an afterthought.... I did try ListView1.ListWrap = False or something like that, but to no avail...
-
Aug 10th, 2006, 06:40 PM
#7
Re: ListView Control...
Create a new ListView, Label and CommandButton. Set ListView view property to report and create a ColumnHeader and don't change anything. Than try this code:
VB Code:
Option Explicit
Private Sub Command1_Click()
With Label1
.Visible = False
'put in here the longest line with Len(yourStrings)
.Caption = "ThisIsYETANOTHERLongStringOfTextThatDoesntFit" 'f.e.
.AutoSize = True
End With
With ListView1
.ListItems.Add , , Label1.Caption
.ColumnHeaders(1).Width = Label1.Width + 200
End With
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|