|
-
February 7th, 2000, 12:46 AM
#1
Combo Box
i want the combo box that i am using to display multile columns.
how do i do it.
i am using it for database progg.
reply asap.
Regards,
Tejas Jois
-
February 7th, 2000, 11:10 AM
#2
Re: Combo Box
combo boxes don't have a multi-column option, and how would you use it if they did? List boxes do. If that's what you were referring to then for a list box set lb.columns = n where n > 0 and as many columns as needed will be made to hold the data.
-
February 7th, 2000, 01:11 PM
#3
Re: Combo Box
i want the list box controls to refer to differnet columns.
i.e. the first column shld rfer to one field in the database,while the next column shld refer toanother field. how do i do this.??
Tejas Jois
-
February 7th, 2000, 05:37 PM
#4
Re: Combo Box
Without going to a third party control - this is the best you can do:
Use the Win32 API to set tab stops in a Visual Basic list box by creating these declarations and routine in a module:
public Const LB_SETTABSTOPS = &H192
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(byval hwnd as Long, _
byval wMsg as Long, _
byval wParam as Long, _
lParam as Any)as Long
Sub SetListTabStops(iListHandle as Long)
' sets 2 tab stops in a list box at the 24th
' and 48th character
' iListHandle = the window handle of the list box
Dim iNumColumns as Long
Dim iListTabs(1) as Long
Dim Ret as Long
iNumColumns = 2
iListTabs(0) = 96 ' 96/4 = 24 characters
iListTabs(1) = 192 ' 192/4 = 48 characters
Ret = SendMessage(iListHandle, LB_SETTABSTOPS, iNumColumns, iListTabs(0))
End Sub
In your form, create a list box called lstMyListBox. Call this routine in the form load to set your tab stops:
Call SetListTabStops(lstMyListBox.hwnd)
Then add items to the list box using vbTab:
lstMyListBox.AddItem "Column 1 data" & vbTab & "Column 2 data"
You can adjust the number of columns and their width by change the values of iListTabs().
Hope this helps,
John
John Pirkey
MCSD
www.ShallowWaterSystems.com
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
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
|