|
-
Jun 26th, 1999, 12:09 PM
#1
Thread Starter
Lively Member
i make a listCox, and into it i add stuff from databse file,
question: how can i make a kind of headline to the listBox, make it like a table with two or more columns, i want one column from the dataFile to be displayed in one column of the listBox, and another column in the data file, in another column in the listBox
how can i do that ?
-
Jun 27th, 1999, 02:22 AM
#2
New Member
Want to create a simple list box that shows several fields of data? The columns property of the list box does not do this, but you can use this function to do it.
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"
------------------
-
Jun 27th, 1999, 02:25 AM
#3
New Member
Want to create a simple list box that shows several fields of data? The columns property of the list box does not do this, but you can use this function to do it.
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"
------------------
-
Jun 27th, 1999, 09:13 AM
#4
Thread Starter
Lively Member
for some reason this doesnt work, i wanted the listbox to be like a dbgrid, only without the grid. - if it even possible.
-
Jun 28th, 1999, 11:00 AM
#5
New Member
Hi,
I did a small mistake. Replace list1 by lstListBox and put the following statements into a module
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(lstListBox.hWnd, LB_SETTABSTOPS, 0&, ByVal 0&)
'set list tabstops
Call SendMessage(lstListBox.hWnd, LB_SETTABSTOPS, _
CLng(UBound(TabArray)), TabArray(0))
End Sub
Declare the following statement in General Declaration of a form
Dim Tabs(2) as Long
Then put the following statements into form_load event
Tabs(0) = 0
Tabs(1) = 100
Tabs(2) = 200
DoTabs List1, Tabs
List1.AddItem "Vikraman" & vbTab & "Parthiban" & vbTab & "Aishwarya"
List1.AddItem "Suresh Babu" & vbTab & "Thiyagarajan" & vbTab & "Ganesh"
then execute and get the result whatever you expect.
Hint: -Add a list control into your form
-Size of array tabs mention that how many columns you are going to add
Bye!
------------------
-
May 2nd, 2001, 07:05 PM
#6
Addicted Member
1h$®ÊØØ@’@îÂæ@ÂÄØÊ@èÞ@ÊÜÆäòàè@æÞÚÊèÐÒÜÎ@ÂÜÈ@ÈÊÆäòàè@Òè@Â ØæÞB
BB@¬Êäò@ÆÞÞØ@àäÞÎäÂÚX’@îÒØØ@ÐÊØà@òÞê@ÈÊìÊØÞàÊ@Òè@ÒÌ@òÞê @îÂ
ÜèZøZ@êäÎÐ@ZøZöÎäÒÜúöÆÞÞØúöæÚÒØÊútîÒÜÖtöÊÊÖúöÊòÊæ úö
äÌÂÆÊúöæÞèúöÌäÞîÜúöÚÂÈúö~~~ú
^7*
Email: [email protected]
Website: http://www.hurgh.org/
Unix, Linux, FreeBSD, OpenBSD, Solaris, Windows
C, C++, PHP, VB6, ASP, VBScript, JavaScript
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|