Hello. Can someone tell me how can i add string to combo box? i tried
GetDlgItem(IDC_COMBO1)->Items->Add("Text");
but it didn't worked. and everything that i could find on google didn't helped :( so i'm asking you pros ;)
Hello. Can someone tell me how can i add string to combo box? i tried
GetDlgItem(IDC_COMBO1)->Items->Add("Text");
but it didn't worked. and everything that i could find on google didn't helped :( so i'm asking you pros ;)
Since this is MFC, see CComboBox::AddString() GetDlgItem()
returns a CWnd *
, meaning that you need a typecast to CComboBox *
.
For example
CComboBox * pCombo = (CComboBox *) GetDlgItem(IDC_COMBO1);
pCombo->AddString("Text");
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.