May 28th, 2009, 10:00 AM
#1
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..............
May 28th, 2009, 10:21 AM
#2
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.
May 28th, 2009, 10:22 AM
#3
Re: regarding simple usage of combo box
What is "a default drop down menu" in a combobox?
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"));
...
}
{
Victor Nijegorodov
May 28th, 2009, 12:11 PM
#4
Re: regarding simple usage of combo box
then how can i use the value selected by the user??
May 28th, 2009, 12:16 PM
#5
Re: regarding simple usage of combo box
Originally Posted by
pinnachio
then how can i use the value selected by the user??
Have you tried reading the documentation in MSDN?
May 28th, 2009, 12:16 PM
#6
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);
Victor Nijegorodov
May 28th, 2009, 12:46 PM
#7
Re: regarding simple usage of combo box
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks