Results 1 to 22 of 22

Thread: listview text gets cut off

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    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?

  2. #2
    Addicted Member messup000's Avatar
    Join Date
    Jun 2005
    Posts
    181

    Re: listview text gets cut off

    you mean like a vertical scroll bar???

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    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

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: listview text gets cut off

    Could you use a MsFlexgrid instead? You can set the .RowHeight property of each individual row.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    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

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. ListView1.ListItems(1).Height
    The height is read only but it may be possible while subclassing.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    Re: listview text gets cut off

    i dont even know what subclassing is
    im not that good in vb

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    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?

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: listview text gets cut off

    I think there is a .wordwrap property.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    Re: listview text gets cut off

    yup, there is, but it isnt working. text is still cut off

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    Re: listview text gets cut off

    manually placing line breaks is okay, since i dont have that much info. how would i do that?

  15. #15
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: listview text gets cut off

    I set .wordwrap=true, and then used this.
    VB Code:
    1. .TextMatrix(2, 1) = "*" & vbCrLf & "1"

    of course, you have to make the row height large enough for two lines.

  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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:
    1. MsgBox "Testing" & vbNewline & "Next line." 'for ex.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  17. #17

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    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?

  18. #18
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: listview text gets cut off

    Yes, its in there.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.     MSFlexGrid1.Row = 1
    5.     MSFlexGrid1.Col = 1
    6.     MSFlexGrid1.TextMatrix(1, 1) = "Test"
    7.     MSFlexGrid1.CellForeColor = 255 ' = "[color=red]Test[/color]"
    8. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  19. #19

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2004
    Posts
    294

    Re: listview text gets cut off

    nice thank you

  20. #20
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    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.

  21. #21
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  22. #22

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width