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. Combo box help

Combo box help

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++help
10 Posts 2 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.
  • C Offline
    C Offline
    celllllllll
    wrote on last edited by
    #1

    Hi All, I need to know how to set a default value in Combo Box. For example, right now I have a combo box with 3 times in it (Train, Bus, Both). I need to set "BOTH" as a default value in the combo box. Thanks in advance :)

    C++Prog

    M 1 Reply Last reply
    0
    • C celllllllll

      Hi All, I need to know how to set a default value in Combo Box. For example, right now I have a combo box with 3 times in it (Train, Bus, Both). I need to set "BOTH" as a default value in the combo box. Thanks in advance :)

      C++Prog

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      You can send the combobox a CB_SETCURSEL message (CComboBox::SetCurSel() in MFC). Mark

      C 1 Reply Last reply
      0
      • M Mark Salsbery

        You can send the combobox a CB_SETCURSEL message (CComboBox::SetCurSel() in MFC). Mark

        C Offline
        C Offline
        celllllllll
        wrote on last edited by
        #3

        Thanks a lot Can I do it in 'Combo Box properties dialog'..or need to write a code for it?

        C++Prog

        M 2 Replies Last reply
        0
        • C celllllllll

          Thanks a lot Can I do it in 'Combo Box properties dialog'..or need to write a code for it?

          C++Prog

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Only at runtime, anytime after the Windows object (HWND) is created. In response to the WM_INITDIALOG message is a good place :) Mark

          1 Reply Last reply
          0
          • C celllllllll

            Thanks a lot Can I do it in 'Combo Box properties dialog'..or need to write a code for it?

            C++Prog

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            And...you'll want to do that AFTER you add items to the combobox! Mark

            C 2 Replies Last reply
            0
            • M Mark Salsbery

              And...you'll want to do that AFTER you add items to the combobox! Mark

              C Offline
              C Offline
              celllllllll
              wrote on last edited by
              #6

              I got it.....its working.....Thanks a bunch.

              C++Prog

              1 Reply Last reply
              0
              • M Mark Salsbery

                And...you'll want to do that AFTER you add items to the combobox! Mark

                C Offline
                C Offline
                celllllllll
                wrote on last edited by
                #7

                Here comes another thing...I need to do it dynamically. SetCurSel will make it static. Thanks again

                C++Prog

                M 1 Reply Last reply
                0
                • C celllllllll

                  Here comes another thing...I need to do it dynamically. SetCurSel will make it static. Thanks again

                  C++Prog

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #8

                  Preeti9 wrote:

                  I need to do it dynamically. SetCurSel will make it static.

                  How so? It should just select/highlight the string, scrolling it into view if necessary.

                  C 1 Reply Last reply
                  0
                  • M Mark Salsbery

                    Preeti9 wrote:

                    I need to do it dynamically. SetCurSel will make it static.

                    How so? It should just select/highlight the string, scrolling it into view if necessary.

                    C Offline
                    C Offline
                    celllllllll
                    wrote on last edited by
                    #9

                    o okay...I got it.... Thanks

                    C++Prog

                    M 1 Reply Last reply
                    0
                    • C celllllllll

                      o okay...I got it.... Thanks

                      C++Prog

                      M Offline
                      M Offline
                      Mark Salsbery
                      wrote on last edited by
                      #10

                      :)

                      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