locked
How to access data in combo box RRS feed

  • Question

  • Hi,

    I have a problem with accessing my combo box in Dialog.I am getting error when trying to store data in a string array using GetItemData().My code is,
    CString Variable[50];
    int nv = 0 ;
    m_select.InsertString(0,_T("24t")); //Combo box Variable - m_select
    m_select.InsertString(1,_T("1At"));
    Variable[nv] = m_select.GetItemData(nv);

    I am getting this error : while trying to match the argument list '(CString, DWORD_PTR)'
    Can any one pls guide me on this?..

    Shiva..

    Saturday, February 27, 2010 1:56 PM

Answers

  • Hello Siva MS,

    1. CComboBox::GetItemData() returns a DWORD and so it cannot be set to a CString variable "Variable[nv]".

    2. If you want to get the string at an index location of the list box of a combo box, use the CComboBox::GetLBText() method, e.g. :

    m_select.GetLBText(nv, Variable[nv]);

    - Bio.


    • Marked as answer by Siva MS Saturday, February 27, 2010 4:11 PM
    Saturday, February 27, 2010 2:28 PM