Article ID: 112195
Article Last Modified on 10/20/2003
List1.AddItem Data1.Recordset(Field1) & Chr$(9) & Data1.Recordset(Field2)
Dim X As Integer X = InStr(List1.Text, Chr$(9)) Text1 = Mid$(List1.Text, 1, X - 1) ' Will Contain Field1 Text2 = Mid$(List1.Text, X + 1, (Len(List1.Text) - X)) ' Contains Field2
71067 : How to Set Tab Stops in a List Box in Visual Basic
Property Setting Comment --------------------------------------- DatabaseName BIBLIO.MDB The sample db in the Visual Basic directory Recordsource Authors The Authors table is in BIBLIO.MDB
Sub Form_Load()
Data1.Refresh
' Loop until you reach the last record:
Do Until Data1.Recordset.EOF
' Load the list box with fields separated with a tab:
' Enter the following two lines as one, single line:
List1.AddItem Data1.Recordset("Au_Id") & Chr$(9) &
Data1.Recordset("Author")
Data1.Recordset.MoveNext
Loop
' Initialize list box and text boxes to first item:
List1.ListIndex = 0
End Sub
Sub List1_Click()
Dim X As Integer
' Find first tab character:
X = InStr(List1.Text, Chr$(9))
' Put all characters before tab into Text1:
Text1 = Mid$(List1.Text, 1, X - 1)
' Put all characters after tab into Text2:
Text2 = Mid$(List1.Text, X + 1, (Len(List1.Text) - X))
End Sub
Additional query words: 3.00
Keywords: KB112195