开发者

Input Data in my Combo Box

I feel really silly asking this question but how do you add any data to a Combo Box? Like I want to display A,B and C as my dropbox strings but I have tried out many things, still my Combo Box does not display anything.

I have tried setting the 'Data' property with A;B;C..still it doesn't show this.

I tried this in my Oninitdialog() function:

CCombo开发者_JAVA技巧Box* pComboBox = (CComboBox*)GetDlgItem(IDC_SENSOR_LIST);

    CString string;
    for(int i=0;i<10; i++)
    {
        string.Format("String %d", ++i);
        pComboBox->AddString(string);
    }

.. still no change. It may be I might not be doing something really silly but not able to figure it out at the moment. Kindly help.

Cheers.


Make sure your combobox has a height that can hold all entries. The height of a combo box doesn't affect the combo box itself, but the dropdown list.

You can change it in the dialog editor: Click on the down arrow of the combo box, now there should be a rectangle that allows you to change the height of the combobox dropdown list. Make it large enough to hold all entries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜