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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Combo Boxes and Vars

Combo Boxes and Vars

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 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.
  • E Offline
    E Offline
    Eversman
    wrote on last edited by
    #1

    Hey, Got a question for you guys. I have 7 combo boxes. All with time duration options in them, like 10 mins, 20 mins etc etc. Then I have an edit box that is to display the total of the values selected from the 7 combo boxes. Here is the code I have so far. void CDEPDlg::OnCloseupCombo15() { // TODO: Add your control notification handler code here int totalswim=0; int cur1 = m_dur1.GetCurSel (); CString text1; m_dur1.GetLBText (cur1, text1); if (text1 == "10 Minutes") { totalswim=+10; m_swimtime=totalswim; } } m_dur1 is the 1st combo box, m_dir2 is the second etc etc. m_swimtime is an int var of the edit box. Thanks for any help

    C C 2 Replies Last reply
    0
    • E Eversman

      Hey, Got a question for you guys. I have 7 combo boxes. All with time duration options in them, like 10 mins, 20 mins etc etc. Then I have an edit box that is to display the total of the values selected from the 7 combo boxes. Here is the code I have so far. void CDEPDlg::OnCloseupCombo15() { // TODO: Add your control notification handler code here int totalswim=0; int cur1 = m_dur1.GetCurSel (); CString text1; m_dur1.GetLBText (cur1, text1); if (text1 == "10 Minutes") { totalswim=+10; m_swimtime=totalswim; } } m_dur1 is the 1st combo box, m_dir2 is the second etc etc. m_swimtime is an int var of the edit box. Thanks for any help

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Don't combo boxes allow each value to have a hidden value associated with it ? Or have I just been web programming for too long ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      1 Reply Last reply
      0
      • E Eversman

        Hey, Got a question for you guys. I have 7 combo boxes. All with time duration options in them, like 10 mins, 20 mins etc etc. Then I have an edit box that is to display the total of the values selected from the 7 combo boxes. Here is the code I have so far. void CDEPDlg::OnCloseupCombo15() { // TODO: Add your control notification handler code here int totalswim=0; int cur1 = m_dur1.GetCurSel (); CString text1; m_dur1.GetLBText (cur1, text1); if (text1 == "10 Minutes") { totalswim=+10; m_swimtime=totalswim; } } m_dur1 is the 1st combo box, m_dir2 is the second etc etc. m_swimtime is an int var of the edit box. Thanks for any help

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

        And what's the question? If you've got a specific question, I'm sure people will be glad to help, but if you're wanting someone to write your code for you, you're probably not going to get what you want. (Or was there a question and I just missed it?)

        E 1 Reply Last reply
        0
        • C Curi0us_George

          And what's the question? If you've got a specific question, I'm sure people will be glad to help, but if you're wanting someone to write your code for you, you're probably not going to get what you want. (Or was there a question and I just missed it?)

          E Offline
          E Offline
          Eversman
          wrote on last edited by
          #4

          heh no, i was wondering how do you get the value in the combo box to be displayed in the edi box? I know how to get strings in there, but doing it the same way using ints, it doesn't work

          C 1 Reply Last reply
          0
          • E Eversman

            heh no, i was wondering how do you get the value in the combo box to be displayed in the edi box? I know how to get strings in there, but doing it the same way using ints, it doesn't work

            C Offline
            C Offline
            Curi0us_George
            wrote on last edited by
            #5

            Ah. I see. All you need is to convert your calculated integer into a string. One way you can do that is with the CString Format() method: CString str; int someInt = 1000; str.Format(TEXT("%i"),someInt); // send your formatted string to the edit control

            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