regarding simple usage of combo box
i have made a combo box in one of my dialog boxes using drag & drop controls
now I wish to add a default drop down menu in it.........how can i do so??please tel a descriptive one went through many books and forums but could not find one suitable..............
Re: regarding simple usage of combo box
You can add data in the resource editor. How you do it depends which version of C++ you're running.
Re: regarding simple usage of combo box
What is "a default drop down menu" in a combobox? :confused:
Or you meant filling in the combobox with the items?
If latter then:
- add control member variable for this combobox, say c_MyCombo
- use CComboBox::AddString method to add items
- you can place such a code in your dialog OnInitDialog method like:
Code:
CSomeDialog::OnInitDialog()
CDialog::OnInitDialog();
c_MyCombo.AdddString(_T("Item 1"));
c_MyCombo.AdddString(_T("Item 2"));
c_MyCombo.AdddString(_T("Item 3"));
...
}
{
Re: regarding simple usage of combo box
then how can i use the value selected by the user??
Re: regarding simple usage of combo box
Quote:
Originally Posted by
pinnachio
then how can i use the value selected by the user??
Have you tried reading the documentation in MSDN?
Re: regarding simple usage of combo box
CComboBox::GetCurSel
CComboBox::GetLBText
Code:
CString strText;
int ind = c_Combo.GetCurSel();
if(ind != CB_ERR)
c_Combo.GetLBText(ind, strText);
Re: regarding simple usage of combo box