Solved

Regarding ListView Display

Posted on 2003-11-16
8
167 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now