listview text gets cut off
do you know when you enter alot of text in a listview, it gets cut off. I have the code to auto resize it to expand the width, but i dont want that. i want to do is expand it vertically (height-wise) so it wont get cut off. anyone know how to do this?
Re: listview text gets cut off
you mean like a vertical scroll bar???
Re: listview text gets cut off
i dont want a scroll bar, inside the listivew, there are rows and columns of text, and if you enter too much text, it will get cut off. what i want to do is expand it (height-wise). it will look ugly with a scroll bar
Re: listview text gets cut off
Could you use a MsFlexgrid instead? You can set the .RowHeight property of each individual row.
Re: listview text gets cut off
hmmm, im already using listview. i already did alot of work with the listview, is it even possible to do it with the listview? if not, i will probably switch
Re: listview text gets cut off
You could probably change the height for a single row but you would have to subclass the lvw and change its height that way.
VB Code:
ListView1.ListItems(1).Height
The height is read only but it may be possible while subclassing. ;)
Re: listview text gets cut off
i dont even know what subclassing is :(
im not that good in vb
Re: listview text gets cut off
A flexgrid is like a spreadsheet. Very versatile. I would only use a listview if I needed to expand and collapse rows, and now that I learned that you can do the same with a MSHFlexgrid, I don't know if I would unless the data didn't come from a database.
Re: listview text gets cut off
Subclassing is where you go a bit lower into vb programming and hook into the messagestream that receives and sends window messages from windows to and from your form. Probably too much work for this. Perhaps its best to try a duplicate project and change the listview to a grid. ;)
Re: listview text gets cut off
yea im trying to use a grid now, and i did that height the .RowHeight = blah, and the text still gets cut off. of course the height is what i want, but it get cuts off horitonzally. anyone know how to fix this?
Re: listview text gets cut off
I think there is a .wordwrap property. ;)
Re: listview text gets cut off
yup, there is, but it isnt working. text is still cut off :(
Re: listview text gets cut off
Hmm, maybe your going to have to manually place line breaks to make it wrap. Going to be a pain to identify where to place them.
I know the .wordwrap in a listview only works on a listview that is in Large Icon View.
Re: listview text gets cut off
manually placing line breaks is okay, since i dont have that much info. how would i do that?
Re: listview text gets cut off
I set .wordwrap=true, and then used this.
VB Code:
.TextMatrix(2, 1) = "*" & vbCrLf & "1"
of course, you have to make the row height large enough for two lines.
Re: listview text gets cut off
Before you add the item or subitem you will manipulate the string with the Mid$ and Instr functions, for ex., to break the string where you specify. Tehn with parts of your string you will reatach them but place the vbNewline inbetween.
VB Code:
MsgBox "Testing" & vbNewline & "Next line." 'for ex.
Re: listview text gets cut off
ahhhh... you mean like that... thanks alot. i never thought of that and it works! one more question, is it possible to color the column of text like in listview?
Re: listview text gets cut off
Yes, its in there.
VB Code:
Option Explicit
Private Sub Form_Load()
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 1
MSFlexGrid1.TextMatrix(1, 1) = "Test"
MSFlexGrid1.CellForeColor = 255 ' = "[color=red]Test[/color]"
End Sub
Re: listview text gets cut off
Re: listview text gets cut off
I could only get it to change the color of the first cell in the grid. Maybe you have to move explicitly to a cell to change the color of the cell. Filling with textmatrix() doesn't do it.
Re: listview text gets cut off
Yes, correct David. Change the .Row and .Col to the dell you want to change. Then change it and move to the next. ;)
Re: listview text gets cut off
In case you ever want to use the listview this seems to work.
ListView1.Height = (ListView1.ListItems.Count + 2) * ListView1.ListItems(1).Height