Solved

Regarding ListView Display

Posted on 2003-11-16
8
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

710 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