I'm developing an application for a homeless shelter organization. The application uses a list box (I'd really prefer to use a list box) to display their Guest records. I've been having some difficulty having the columns (fields) line up, as shown in the partial display below. (The column headings are Last Name, First Name, Middle Initial and SS Number.)
AARON CHARLES XXX-XX-XXXX
AARON JACK C XXX-XX-XXXX
AARON TEAURAUN A XXX-XX-XXXX
ABBOTT HERBERT C XXX-XX-XXXX
ABBOTT JOHN E XXX-XX-XXXX
ABBOTT KENNETH XXX-XX-XXXX
ABBOTT RICHARD D XXX-XX-XXXX
ABDOURHMAN MAHMOUD XXX-XX-XXXX
ABELT FREDERICK A XXX-XX-XXXX
The code used to display these records follows.
' Load the Guest records into the list box.
With dsDataSet.Tables("tblGuest")
For intIndex = 0 To .Rows.Count - 1
lstRecords.Items.Insert(intIndex, _
.Rows(intIndex).Item("LastName") & Chr(9) & _
.Rows(intIndex).Item("FirstName") & Chr(9) & Chr(9) & _
.Rows(intIndex).Item("MiddleInitial") & Chr(9) & Chr(9) & _
.Rows(intIndex).Item("SSNumber"))
Next
End With
I've tried checking the length of the FirstName field and concatenating one tab (chr(9)) for longer names instead of two, but that doesn't always work (see RICHARD and MAHMOUD above; their length is the same, but MAHMOUD's name is a bit wider (with the .Net font used), so his SS Number jumps to the next tab column).
Do you have any ideas how I could line up the columns? Thank you in advance for your time and consideration!
Ed
AARON CHARLES XXX-XX-XXXX
AARON JACK C XXX-XX-XXXX
AARON TEAURAUN A XXX-XX-XXXX
ABBOTT HERBERT C XXX-XX-XXXX
ABBOTT JOHN E XXX-XX-XXXX
ABBOTT KENNETH XXX-XX-XXXX
ABBOTT RICHARD D XXX-XX-XXXX
ABDOURHMAN MAHMOUD XXX-XX-XXXX
ABELT FREDERICK A XXX-XX-XXXX
The code used to display these records follows.
' Load the Guest records into the list box.
With dsDataSet.Tables("tblGuest")
For intIndex = 0 To .Rows.Count - 1
lstRecords.Items.Insert(intIndex, _
.Rows(intIndex).Item("LastName") & Chr(9) & _
.Rows(intIndex).Item("FirstName") & Chr(9) & Chr(9) & _
.Rows(intIndex).Item("MiddleInitial") & Chr(9) & Chr(9) & _
.Rows(intIndex).Item("SSNumber"))
Next
End With
I've tried checking the length of the FirstName field and concatenating one tab (chr(9)) for longer names instead of two, but that doesn't always work (see RICHARD and MAHMOUD above; their length is the same, but MAHMOUD's name is a bit wider (with the .Net font used), so his SS Number jumps to the next tab column).
Do you have any ideas how I could line up the columns? Thank you in advance for your time and consideration!
Ed