Formatting List Boxes--HELP!!!!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Formatting List Boxes--HELP!!!!

  1. #1
    Bill C Guest

    Formatting List Boxes--HELP!!!!


    Does anybody have a good proicedure for formatting list boxes? I have a recordset
    with about 12 fields and 1 field is a description field of wildly varying
    length. This is causing havoc trying to get all of the fields to align nicely
    since vb tabs and such are all relative to the the field before it. If a
    description is too long or short, the record doesn't line up and the display
    results in a zig-zag look of records in the list box.

  2. #2
    Sundar Guest

    Re: Formatting List Boxes--HELP!!!!


    "Bill C" <bcrider@uasi-qc.com> wrote:
    >
    >Does anybody have a good proicedure for formatting list boxes? I have a

    recordset
    >with about 12 fields and 1 field is a description field of wildly varying
    >length. This is causing havoc trying to get all of the fields to align nicely
    >since vb tabs and such are all relative to the the field before it. If a
    >description is too long or short, the record doesn't line up and the display
    >results in a zig-zag look of records in the list box.


    HI Bill,

    I am not sending any procedure for alining listbox. sorry about that. But
    in similar situation I have used Listview control with so many columns defined
    according to fields this can give better alignment and sorting features.

    regards
    sundar


  3. #3
    T. Bradley Dean Guest

    Re: Formatting List Boxes--HELP!!!!

    Bill,

    There are two ways to do this, I've done both.

    The first is to pick a monospaced font, a font that uses the same amount of
    space per character, regardless of which character it is. Then, just pad the
    text to make all the columns the same size.

    The method I use now is with a control from Proto View. It came with their
    Data Explorer package. They have a list box and a combo box with built in
    columns. You can resize them, sort them, etc. They work, REALLY well
    although the documentation is poor on how to get started. I'm not sure if
    they sell it seperately, but every control in the Data Explorer package is
    really well done. I bought it for the Outllook type GUI, but I've used
    pretty much everything in there.

    Bradley Dean

    Bill C <bcrider@uasi-qc.com> wrote in message news:39c61087@news.devx.com...
    >
    > Does anybody have a good proicedure for formatting list boxes? I have a

    recordset
    > with about 12 fields and 1 field is a description field of wildly varying
    > length. This is causing havoc trying to get all of the fields to align

    nicely
    > since vb tabs and such are all relative to the the field before it. If a
    > description is too long or short, the record doesn't line up and the

    display
    > results in a zig-zag look of records in the list box.




  4. #4
    Eric D. Burdo Guest

    Re: Formatting List Boxes--HELP!!!!

    You can use the SendMessage API with the LB_SETTABSTOPS const and you can
    specify your own tab stops.

    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 LB_SETTABSTOPS = &H192


    Dim lTabCount As Long
    Dim lTabArray() As Long

    ReDim lTabArray(0)

    'List box tabs
    lTabCount = 1 'The number of tabs (0 based) in the box...
    lTabArray(0) = 80 'This is the width of the tabstop. It is NOT
    in characters, so play with it to get what you want...
    lR = SendMessage(ListBox.hWnd, LB_SETTABSTOPS, lTabCount, lTabArray(0))

    --

    Eric D. Burdo, Red-Leif International
    VB Programmer and Consultant
    <http://www.redleif.com/vb>

    *** Please reply to the newsgroup so all can benefit. ***


    "Bill C" <bcrider@uasi-qc.com> wrote in message
    news:39c61087@news.devx.com...
    >
    > Does anybody have a good proicedure for formatting list boxes? I have a

    recordset
    > with about 12 fields and 1 field is a description field of wildly varying
    > length. This is causing havoc trying to get all of the fields to align

    nicely
    > since vb tabs and such are all relative to the the field before it. If a
    > description is too long or short, the record doesn't line up and the

    display
    > results in a zig-zag look of records in the list box.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center