CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Inserting an Integer into a list control

    I am having some difficulty inserting an int into a list control rather than a CString. I cant seem to find a function that will do it for me. What I have so far is:

    CStrint m_blah, m_blahblah, m_blahblahblah;

    item = m_list_ctrl.InsertItem(0, m_blah);

    m_list_ctrl.SetItemText(item,1,m_blahblah);

    m_list_ctrl.SetItemText(item,2,m_blahblahblah);



    I am trying to do something following on from the above like

    int number;

    m_list_ctrl.InsertItemText(item,3,number);



    Obviously this doesn't work.
    Any held would be nice, thanks.
    Thomas


  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: Inserting an Integer into a list control

    You must convert the number to a string representation to display it:

    int number(5);
    CString numberStr;
    numberStr.Format("%d", number);
    m_list_ctrl.SetItemText(item,1,number);

    Dave


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured