Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Copying an arry into a listbox

Copying an arry into a listbox

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheCult
    wrote on last edited by
    #1

    hi, i want to know how to copy the contents of an array of strings into a listbox which can be displaied on screen? Any help would be nice. Thanks

    T 1 Reply Last reply
    0
    • T TheCult

      hi, i want to know how to copy the contents of an array of strings into a listbox which can be displaied on screen? Any help would be nice. Thanks

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      MFC user ? have a look at CListBox::AddString()


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      T 1 Reply Last reply
      0
      • T toxcct

        MFC user ? have a look at CListBox::AddString()


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        T Offline
        T Offline
        TheCult
        wrote on last edited by
        #3

        yeah im a MFC user (only been using c++ for about 2 weeks) Thanks for the help that should do what i want it to do

        T 1 Reply Last reply
        0
        • T TheCult

          yeah im a MFC user (only been using c++ for about 2 weeks) Thanks for the help that should do what i want it to do

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          let consider you array if of type char*

          char str[][]={"code","project","is","great"};

          // now let IDC_LIST1 is id of your list box

          CListBox *m_lst=(CListBox*)GetDlgItem(IDC_LIST1);

          //Check is we got valid pointer

          if(m_lst)
          {
          ///add the values in list box

          for(int i=0;i<4;i++)
          {
          //add string to list box
          m_lst->AddString(str[i]);
          }
          }


          "I Think this Will Help" [Vote One Here,.....]

          visit me at http://www.thisisalok.tk
          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups