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. List Box(simple Question)

List Box(simple Question)

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
6 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.
  • P Offline
    P Offline
    Paddy
    wrote on last edited by
    #1

    How do you add items to a list box??? I have created a dialog in my app and added a list box to it but I have no idea how to add items to it! Thanks in advance. Paddy.

    D T 2 Replies Last reply
    0
    • P Paddy

      How do you add items to a list box??? I have created a dialog in my app and added a list box to it but I have no idea how to add items to it! Thanks in advance. Paddy.

      D Offline
      D Offline
      Dave Bryant
      wrote on last edited by
      #2

      Call the AddString() method. Dave

      P 1 Reply Last reply
      0
      • D Dave Bryant

        Call the AddString() method. Dave

        P Offline
        P Offline
        Paddy
        wrote on last edited by
        #3

        Thanks, The problem I'm actually having is that I don't know how to reference the listbox that I have created with the dialog editor. For example: CListBox* myList; myList->AddString( str ); Do you know What code I need to use so that myList refers to the listbox that I have created in ID_MYDIALOG? Does this make sense? Thanks in advance

        D 1 Reply Last reply
        0
        • P Paddy

          Thanks, The problem I'm actually having is that I don't know how to reference the listbox that I have created with the dialog editor. For example: CListBox* myList; myList->AddString( str ); Do you know What code I need to use so that myList refers to the listbox that I have created in ID_MYDIALOG? Does this make sense? Thanks in advance

          D Offline
          D Offline
          Dave Bryant
          wrote on last edited by
          #4

          Take a look at this article about creating control variables: http://www.codeproject.com/cpp/nogetdlgitem.asp Dave

          P 1 Reply Last reply
          0
          • P Paddy

            How do you add items to a list box??? I have created a dialog in my app and added a list box to it but I have no idea how to add items to it! Thanks in advance. Paddy.

            T Offline
            T Offline
            Thomas Lau
            wrote on last edited by
            #5

            Call AddString() method; For example: myListBox.AddString("Hello!:");

            1 Reply Last reply
            0
            • D Dave Bryant

              Take a look at this article about creating control variables: http://www.codeproject.com/cpp/nogetdlgitem.asp Dave

              P Offline
              P Offline
              Paddy
              wrote on last edited by
              #6

              Thanks Dave, For some reason I can't add any member variables, the "variables" menu item is grayed out when I right click on a control in the dialog editor! It's ok coz I found an easier way of doing it using: SendDlgItemMessage(hDlg, ID_MYLIST, LB_ADDSTRING, 0, (LPARAM)"Hi there!"); Thanks for the help, Paddy.

              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