[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 160
  • Last Modified:

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!
0
chrislee8
Asked:
chrislee8
1 Solution
 
chrislee8Author Commented:
Edited text of question.
0
 
DambalajiCommented:
Set the Sorted property of the ComboBox to True. It will Solve Your Problem
0
 
leg1Commented:
Actually, Dambalaji, it sounds like the problem is that sort is set to true and thus changes in the rst "order by" are not being respected.  Set sort to false and the entries will appear in the same order that they are added.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
chrislee8Author Commented:
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 :)
0
 
caraf_gCommented:
chrislee, you can accept leg1's comment as an answer. Look at the "title bar" on leg1's comment.
0
 
caraf_gCommented:
;-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now