0
votes

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

This is my code.

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's type is CString.

combobox does not show serialNumber list.

how can I do?

1
Is this the same question as this one? - MikMik

1 Answers

0
votes

Is m_pComboBox, as its name implies, a pointer? Then you need:

m_pComboBox->AddString(str);

You'd get a compilation error anyway.

Are you sure you get your list correctly? Isn't it simply empty?