Solved

Keep combobox element in the list, but hide it

Posted on 2008-10-22
2
514 Views
Last Modified: 2013-11-20
Is there a way to keep a combobox element in the index, but hide it from being displayed when the drop down is displayed? I can use DeleteString to get rid of it, but this also destroys the indexing which in my situation is not desirable
0
Comment
Question by:steenpat
2 Comments
 
LVL 14

Accepted Solution

by:
wayside earned 250 total points
ID: 22781361
No can do.

Rather than get the index from the position in the combo dropdown, use SetItemData() to associate the "index" with the element.

When the user makes a selection, a simple call to GetItemData() gets the index back.

When you reinsert the element, use SetItemData() to set its "index" again.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22783737
You could make a owner-drawn combobox where you need to do all drawing yourself. Then, you could replace the text to be shown by a blank string or a ------ line. But it is very much efforts for little benefit. You may consider to simply replace the text of the item by somewhat like "--- not selectable ---" and if the user nevertheless makes the selection do it reverse.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now