Results 1 to 4 of 4

Thread: This has got me stumped! (Headers in list boxes)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 1999
    Posts
    16

    Angry

    All right, I'm stumped. I have wondered for a long time now on how exactly to recreate a list control with the "tabs" on it, making columns appear inside. After running MS Spy++ to find out exactly what I was looking for, I found that it was a "header" inside a list box. This is where I get stumped. How in the world do I implement those into my program? I looked through my help files but to no avail.
    If there is anyone able to help me out, please reply asap!

    Thanks a lot!
    - Jason

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    You're going in the wrong direction, The only way to implement tabs in listboxes in VB is with an API call, it's fairly well documented.

    Actually pasted from another article on this site

    Code:
    Public Const LB_SETTABSTOPS As Long = &H192
    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 Sub DoTabs(lstListBox As ListBox, TabArray() As Long)
    'clear any existing tabs
    Call SendMessage(List1.hWnd, LB_SETTABSTOPS, 0&, ByVal 0&)
    'set list tabstops
    Call SendMessage(List1.hWnd, LB_SETTABSTOPS, _
    CLng(UBound(TabArray)), TabArray(0))
    End Sub
    First, set up the columns:
    
    Dim Tabs(2) as Long
    Tabs(0) = 0
    Tabs(1) = 100
    Tabs(2) = 200
    DoTabs List1, Tabs
    Then, add your items:
    
    List1.AddItem "John" & vbTab & "Percival" & vbTab  "Content Editor"
    List1.AddItem "James" & vbTab & "Limm" & vbTab & "Senior Editor"

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 1999
    Posts
    16

    Question Hmm..

    This seems to work, but it is missing the tabs that show up on the list as headers for the columns. Each tab would appear above each column and would be labled.. How is that done?

    Also, I found that the line:
    Code:
    List1.AddItem "John" & vbTab & "Percival" & vbTab  "Content Editor"
    should appear as:
    Code:
    List1.AddItem "John" & vbTab & "Percival" & vbTab  "Content Editor" & vbTab
    so that it shows up correctly in tabbed form.

    Thanks!
    - Jason

    [Edited by Ravyn on 04-15-2000 at 11:52 AM]

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Aug 1999
    Posts
    16

    Smile I figured it out

    Thanks for your help. I figured out how to use it now.

    - Jason

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width