Click here to Skip to main content
13,149,600 members (56,128 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hey TCP,

So I want to make an application where I use a combo box for the user to choose various conversion options. I don't know how it works or what to code when the user clicks an option and then button's show up to convert. Anyone have a specific tutorial on this or how I can get started on the first one? I've looked through about 5 tutorials and all they tell me are functions but not exactly pertaining to what I'm trying to do.

(or do combo boxes not apply to my situation..?)

Thanks in advance.

Picture provided.

Posted 1-Nov-10 12:10pm
Updated 1-Nov-10 12:31pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Add a handler for the CBN_SELCHANGE event. You can do this via the designer. Select your combobox, and select the Control Events tab in the Properties panel, and choose CBN_SELCHANGE. The auto-added handler will look like this:

void CYourDlg::OnCbnSelchangeCombo1()
    int sel = m_combobox.GetCurSel(); // code to add

The variable sel will be the 0 based index of the user's selection
Paul Camantigue 1-Nov-10 18:57pm
Thanks for your reply, but what do I do from there? Is it possible for me to show different buttons when a different selection is met?
Nishant Sivakumar 1-Nov-10 20:10pm
Why show different buttons? Show the same button, but just change its text based on what the user selected.
«_Superman_» 1-Nov-10 20:12pm
I presume you want to show different text based on the selection.
For this you can change the text on the controls using SetWindowText.
To show entirely different control based on the selection, you could hide irrelevant controls and show relevant ones using ShowWindow.
You can also create controls dynamically using CreateWindow, but that is not recommended.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170924.2 | Last Updated 1 Nov 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100