zachvaldez
asked on
Put this in a listbox .
If Not RsType.EOF Then
With ctrControl
Do Until RsType.EOF
.AddItem Trim(RsType("Book"))
.AddItem Trim(RsType("cost"))
.AddItem Trim(RsType("list"))
.ItemData(.NewIndex) = RsType("id")
RsType.MoveNext
Loop
End With
End If
I have this achieve but it is displaying in the listbox incorrectly.
The question is how to put the resultset in each column in a listbox
With ctrControl
Do Until RsType.EOF
.AddItem Trim(RsType("Book"))
.AddItem Trim(RsType("cost"))
.AddItem Trim(RsType("list"))
.ItemData(.NewIndex) = RsType("id")
RsType.MoveNext
Loop
End With
End If
I have this achieve but it is displaying in the listbox incorrectly.
The question is how to put the resultset in each column in a listbox
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
const MaxLen =15
If Not RsType.EOF Then
With ctrControl
Do Until RsType.EOF
.AddItem m_FormatItem(RsType("Book"
.ItemData(.NewIndex) = RsType("id")
RsType.MoveNext
Loop
End With
End If
Private Function m_FormatItem(Itm As String, ItemLen As Integer) As String
m_FormatItem = Trim(Itm) & Space(ItemLen - Len(Itm))
End Function
where maxlen is "column" width - you have to be sure that string from rs is not larger than maxlen