-
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
-
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"
-
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]
-
I figured it out
Thanks for your help. I figured out how to use it now.
- Jason