CComboBox how to use MSVS2010 (C++)

Sorry, I'm lost.  I create a member variable for a CComboBox and called it m_charts.
In CMainFrame implementation I can instantiate CDialog derived object containing this member variable and I can run AddString() to populate it.

So how do I read strings from it?

Here is how far I've gotten.
1.  Class Wizard
2.  Choose my resource IDD_REVEAL_STATE which is the dialog box resource
3.  Pick member variable tab.
4.  Choose the member for the CComboBox
Now what?
I need to start handling messages.  I hope I don't have to subclass again.  Can you help?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

you now can add event handlers for the combo box member. do a right-click on the control in resource editor and choose 'Add EventHandler...'. you probably would handle the events CBN_SELCHANGE and CBN_SELENDOK.

to read strings from combo box you could call m_yourcombo.GetCurSel() to get the index of the currently selected item. Then you could get the string m_yourcombo.GetLBText function where you pass the index as input.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
supportorangesAuthor Commented:
Thank you, could not remember for the life of me...
the text that is in the editbox of the combobox (either by editing or by selection) can be retrieved by GetWindowText in your dialogs member functions. alternatively, you may add a CString member variable for your combobox in resource editor (right-click + 'Add Variable ...'). then, by UpdateData(TRUE); the CString member was filled with current contents of combobox control from screen (plus all other screen data from controls where you have added a member variable for the value). with UpdateData(FALSE); you can populate your controls from members. that typically is made in OnInitDialog member function.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.