Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Populate Drop Down in MFC

I am trying populate a combo box in MFC application with no luck, I have tried all the methods available on internet but none seems to work for me, if I try to enter the values using data option in property windows like "value 1; value 2" only value 2 displays in combo box, if I try to add it using

comboxbox.AddString("value 1");

I get

left side of AddString must have class/union/struct.

I am using Visual Studio 2008.

like image 320
TilalHusain Avatar asked Jul 24 '11 06:07

TilalHusain


1 Answers

CComboBox* pComboBox = (CComboBox*)GetDlgItem(YOUR_COMBO_ID);

pComboBox->AddString( _T( "Value" ) ); 
pComboBox->AddString( _T( "Value" ) ); 

To know what _T means: Read this

like image 150
Ajay Avatar answered Sep 27 '22 23:09

Ajay