Link to home
Start Free TrialLog in
Avatar of chrislee8
chrislee8

asked on

sorting problem in VB's combo box.

hi all,
I have a recordset contains 2 fields.
here is my code to load the recordset to the combo box:
    cboBoxToLoad.Clear
    objADORecordset.MoveFirst
    Do While Not objADORecordset.EOF
        cboBoxToLoad.AddItem objADORecordset.Fields(0)
        If bIsItemData Then
            cboBoxToLoad.ItemData(cboBoxToLoad.NewIndex) =
objADORecordset.Fields(1)
        End If
        objADORecordset.MoveNext
    Loop

in the database, I am setting the fields(0) desc and asc. but no matter what
i set, the combo box shows up the records asc for the fields(0).

Please help!
Avatar of chrislee8
chrislee8

ASKER

Edited text of question.
Set the Sorted property of the ComboBox to True. It will Solve Your Problem
ASKER CERTIFIED SOLUTION
Avatar of leg1
leg1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am sorry, Dambalaji, leg1 is right.
leg1, would you answer the question so that i can give you the points.
Dam, again, nothing personal.

Thank you guys so much for your time.

it works well now.

chris :)
chrislee, you can accept leg1's comment as an answer. Look at the "title bar" on leg1's comment.
;-)