Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

removing sort in a listbox

Posted on 1998-07-02
3
Medium Priority
?
213 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 200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

886 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