Solved

removing sort in a listbox

Posted on 1998-07-02
3
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
NotAlone Challenge 20 88
matchUp  challenge 9 125
Authenticate using sesu from script 7 111
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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