Solved

Regarding ListView Display

Posted on 2003-11-16
8
169 Views
Last Modified: 2010-05-03
This might be a very simple question to most of you, but i just couldn't find the properties to set it nor online tutorial help much.

I have a listview using lvwList, and all my list item has text which is quite long and result in dot dot dot display which i don't want. For example I want it to Display as "working folder" but it display something like "working f......". How can I explicity set the length of it or make it auto fit my length of string?

thnx for help
0
Comment
Question by:biao81
8 Comments
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9761528
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const LVSCW_AUTOSIZE_USEHEADER As Long = -2
Public Const LVM_SETCOLUMNWIDTH As Long = (LVM_FIRST + 30)

Public Sub FixWidth(Lv As ListView)
    On Error Resume Next
    Dim col2adjust As Long
    For col2adjust = 0 To Lv.ColumnHeaders.Count - 1
        Call SendMessage(Lv.hwnd, LVM_SETCOLUMNWIDTH, col2adjust, ByVal LVSCW_AUTOSIZE_USEHEADER)
    Next
End Sub


declare all that in a module, then call to it like this:

fixwidth YourListView

call it whenever you make changes to the list listview, replace YourListView with the listview in your program
0
 

Author Comment

by:biao81
ID: 9762459
not working
0
 
LVL 3

Expert Comment

by:NBrownoh
ID: 9762547
is it feeding back an error?  call that after you put something new or remove something from the listview.  make sure the name matches.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 3

Expert Comment

by:NBrownoh
ID: 9762683
if you are declaring all that stuff in a form you need to switch them to Private instead of Public, that is meant to be in a module...
0
 

Author Comment

by:biao81
ID: 9768288
Anyway, I just got lots of error, one of the error i'm facing now is
"LVM_FIRST" Constants expression required
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10548509
biao81, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.
    *** good PAQworthy code from NBrownoh, but no followup

Dan Rollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 10598655
PAQed, with points refunded (20)

CetusMOD
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question