如何添加项到组合框? [英] How to add item to a combobox?

查看:167
本文介绍了如何添加项到组合框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MFC的新手。
我不知道如何添加值到组合框。
我有一个向量类。

I am a newbie to MFC. I don't know how to add values to a combobox. I have a vector class.

这是我的代码。

CellPhone cp;
vector<CellPhone> cellPhoneList;
cellPhoneList = cp.loadCellPhone();

m_pComboBox.SetCurSel(0);

for(unsigned int i=0; i<cellPhoneList.size(); i++)
{

  CString str = cellPhoneList[i].getSerialNumber();
  m_pComboBox.AddString(str);

}

serialNumber的类型是CString。

serialNumber's type is CString.

组合框不显示serialNumber列表。

combobox does not show serialNumber list.

我怎么办?

推荐答案

也许你必须将 .getSerialNumber()转换为字符串。

Maybe you have to convert your .getSerialNumber() to a string in first place.

这篇关于如何添加项到组合框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆