Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Regarding ListView Display

Posted on 2003-11-16
8
Medium Priority
?
173 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
Independent Software Vendors: 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

660 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