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. how can I warn to make a choice for numeric edit box?

how can I warn to make a choice for numeric edit box?

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 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
    Emre Zorlu
    wrote on last edited by
    #1

    when I use string ,I can write m_StringeditBox.GetWindowText (str); if(str.IsEmpty()){ MessageBox("please,choose one of them ! "); return; } like tihs ! if I use edit box for numeric value how can I warn ? emroz

    D K 2 Replies Last reply
    0
    • E Emre Zorlu

      when I use string ,I can write m_StringeditBox.GetWindowText (str); if(str.IsEmpty()){ MessageBox("please,choose one of them ! "); return; } like tihs ! if I use edit box for numeric value how can I warn ? emroz

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      In the same way.

      E 1 Reply Last reply
      0
      • D David Crow

        In the same way.

        E Offline
        E Offline
        Emre Zorlu
        wrote on last edited by
        #3

        it didn't work:( emroz

        D 1 Reply Last reply
        0
        • E Emre Zorlu

          it didn't work:( emroz

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          How about a code snippet?

          E 1 Reply Last reply
          0
          • E Emre Zorlu

            when I use string ,I can write m_StringeditBox.GetWindowText (str); if(str.IsEmpty()){ MessageBox("please,choose one of them ! "); return; } like tihs ! if I use edit box for numeric value how can I warn ? emroz

            K Offline
            K Offline
            keegan
            wrote on last edited by
            #5

            i do it by adding a variable for the edit box to the class. right click on m_StringeditBox class, go to add variable. Select 'control' from the check boxe, and change "Category:" to variable. add a variable name, and add min. and max. value and you're set, it makes it mandatory for a user to enter something. *.* cin >> knowledge;

            1 Reply Last reply
            0
            • D David Crow

              How about a code snippet?

              E Offline
              E Offline
              Emre Zorlu
              wrote on last edited by
              #6

              When I add information to access table ,I use this code ! set.m_access_attribute = GetDlgItemInt (IDC_EDIT1); How can I warn to fill edit box ? emroz

              D 1 Reply Last reply
              0
              • E Emre Zorlu

                When I add information to access table ,I use this code ! set.m_access_attribute = GetDlgItemInt (IDC_EDIT1); How can I warn to fill edit box ? emroz

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                I don't use GetDlgItemInt() (see below), but if that is what you are limited to, you'll want to use its second parameter, lpTrans. If it is 0 upon return, an error was encountered in translating the edit control text. This includes being empty. Whether I'm dealing with letters, numbers, or a combination of the two, I extract edit box data using GetWindowText(). It's easy to check for emptiness, and if the end result needs to be stored in a number, atoi() is only a function call away.

                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