Solved

removing sort in a listbox

Posted on 1998-07-02
3
203 Views
Last Modified: 2013-11-19
How do you set the properties of a combo box so it does not sort the items which you add to it using the
AddString(..) function, but displays them in the drop-down list in the order by which you added them to the combo box?
0
Comment
Question by:nicholso
3 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 50 total points
ID: 1318631
Remove CBS_SORT style from combo box with ModifyStyle(CBS_SORT, 0, 0);
0
 

Author Comment

by:nicholso
ID: 1318632
I already tried that and I can't get it to work... below is the code I'm trying but it doesn't
do it. The variable m_adaptationTypeCtrl is a CComboBox mapped to the control in the
dialog that I want to be non-sorted. ?

      m_adaptationTypeCtrl.ModifyStyle(CBS_SORT, 0, 0);
      UpdateData(false);

I don't understand why it isn't working, any help would be appreciated.

0
 
LVL 2

Expert Comment

by:jstolan
ID: 1318633
I seem to recall that although the sort style is removed, that internally the combo box does not change.  I think your answer is to create a new combo box without the sort property (in the same location as the first one), copy the strings in and destroy the original.  It's ugly I know, but I don't see another answer.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question