Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a dialog in SDI and put a combo box into the dialog.
The following is the initialization of the combo box:

C#
BOOL CprojectDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // TODO: Add extra initialization here
    m_combobox1.AddString("Bilinear");
    m_combobox1.AddString("Near-neighbor");

    m_combobox1.SetCurSel(0);

    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}


But, I can't find any items shown when running the program. What is the problem?
Thank you!
Posted

In order for that to work, you need to have m_combobox1 listed in the DDX Controls for DoDataExchange. Otherwise it will not be properly subclassed and the AddString function won't do anything to the visible control.

You didn't post the other portions of the "setup" for the class so that's the best I can come up with until we see more of the code.
 
Share this answer
 
This[^] will help to clear your concepts regarding dialog data exchange. For more, have a look at this[^] as well.
 
Share this answer
 
A size problem surly,
your combo box drop down size may small that not display your added values.

to increase size of your combo box click trianle button of combo and increase size..
 
Share this answer
 
Comments
Chandrasekharan P 1-Nov-11 10:07am    
I guess this is his problem. I dont see any other problem with his code snippet

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900