|
-
Feb 1st, 2000, 01:58 AM
#1
Thread Starter
New Member
Hello, is there a way to organize my listbox so that i can have the entries in line:
Jostein-----Solstad----VB-----Programmer
John--------Smith------Java---Programmer
instead of
Jostein Solstad VB Programmer
John Smith Java Programmer
best
jostein
[This message has been edited by dialafc (edited 02-01-2000).]
-
Feb 1st, 2000, 03:12 AM
#2
Change the Listbox's FontName Property to a Fixed Width Font, like Courier.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Feb 1st, 2000, 03:23 AM
#3
Thread Starter
New Member
No, thats not what i ment. How can i specify lenght of each entry in the same line in the listbox ?
is there such a way. in VBA i know u can do it, but can you in normal VB ?
-
Feb 1st, 2000, 03:48 AM
#4
Use a MSFlexGrid Control instead, ie.
Code:
Private Sub Form_Load()
Dim iIndex As Integer
With MSFlexGrid1
.FixedCols = 0
.FixedRows = 0
.SelectionMode = flexSelectionByRow
.FocusRect = flexFocusNone
.Cols = 3
.Rows = 0
.ScrollTrack = True
.ScrollBars = flexScrollBarVertical
.GridLines = flexGridNone
.ColWidth(0) = 2000
.ColWidth(1) = (.Width - 2000) / 2
.ColWidth(2) = (.Width - 2000) / 2
End With
For iIndex = 1 To 10
MSFlexGrid1.AddItem "Row" & iIndex & " - Column1" & Chr(9) & "Column2" & Chr(9) & "Column3"
Next
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Feb 1st, 2000, 03:59 AM
#5
Sure. You can setup TABSTOPS for the Listbox, so everything in that list would be lined up:
Code:
Option Explicit
Private Const LB_SETTABSTOPS As Long = &H192
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Command1_Click()
With List1
.AddItem "Jostein" & vbTab & "Solstad" & vbTab & "VB" & vbTab & "Programmer"
.AddItem "John" & vbTab & "Smith" & vbTab & "Java" & vbTab & "Programmer"
End With
End Sub
Private Sub Form_Load()
Dim arrTabs(2)
arrTabs(0) = 0
arrTabs(1) = -142
arrTabs(2) = 154
'clear any existing tabs
Call SendMessage(List1.hWnd, LB_SETTABSTOPS, 0, ByVal 0)
'set list tabstops
Call SendMessage(List1.hWnd, LB_SETTABSTOPS, 4, arrTabs(0))
End Sub
But for this purpose, you better use Grid or ListView, because you can create headers like: FirstName, LastName, Skills etc, and then populate those columns accordingly.
Regards,
------------------
Serge
Programmer Analyst
[email protected]
[email protected]
ICQ#: 51055819
-
Feb 1st, 2000, 04:28 AM
#6
Thread Starter
New Member
Yes, thnx. This seems to work ok.
Tough i wonder. How can i set the vbTab sice ? i can set vbTab twice for sure...
but when some of the fields are short or long, this affects the look of it..not nice
i seem to have trouble finding this listView thing, wich is something i would like to try to use..
[This message has been edited by dialafc (edited 02-01-2000).]
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
|