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. Check Numeric value

Check Numeric value

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionhelp
6 Posts 4 Posters 1 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.
  • G Offline
    G Offline
    garfield185
    wrote on last edited by
    #1

    How can I check if the text inside a CEdit is numeric? I mean: "2355345" Yes "3452fsgd" No "fsdgsdg" No "sds334" No I usually use the IsNumeric () function but it seems that in Visual C++ is not available... Can somebody help me? :(

    _ A G L 4 Replies Last reply
    0
    • G garfield185

      How can I check if the text inside a CEdit is numeric? I mean: "2355345" Yes "3452fsgd" No "fsdgsdg" No "sds334" No I usually use the IsNumeric () function but it seems that in Visual C++ is not available... Can somebody help me? :(

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      You can choose to let the user enter only the numbers . Right click the edit box and set the number property to true. So in this manner the user won't be able to enter any text in the edit box(except number)

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      1 Reply Last reply
      0
      • G garfield185

        How can I check if the text inside a CEdit is numeric? I mean: "2355345" Yes "3452fsgd" No "fsdgsdg" No "sds334" No I usually use the IsNumeric () function but it seems that in Visual C++ is not available... Can somebody help me? :(

        A Offline
        A Offline
        Anurag Gandhi
        wrote on last edited by
        #3

        If you just want to allow only numeric value in the Edit Box, Go to property window and Set the Number property to True. Or If you want to validate it after user have entered the character, use Dailog Data Exchange (DDX) and Dialog Data Validate (DDV) in DoDataExchange(CDataExchange* pDX) function. Else Scan the text and use isdigit() for each char. If any one have better solution, pls let me know.

        Anurag Gandhi.

        1 Reply Last reply
        0
        • G garfield185

          How can I check if the text inside a CEdit is numeric? I mean: "2355345" Yes "3452fsgd" No "fsdgsdg" No "sds334" No I usually use the IsNumeric () function but it seems that in Visual C++ is not available... Can somebody help me? :(

          G Offline
          G Offline
          garfield185
          wrote on last edited by
          #4

          Gosh!! Thank you very mucho to both of you. As _AnShUmAn_ says, "Some things are hard to do UNTIL WE KNOW HOW TO DO THEM". That´s true... :-O

          _ 1 Reply Last reply
          0
          • G garfield185

            How can I check if the text inside a CEdit is numeric? I mean: "2355345" Yes "3452fsgd" No "fsdgsdg" No "sds334" No I usually use the IsNumeric () function but it seems that in Visual C++ is not available... Can somebody help me? :(

            L Offline
            L Offline
            Lane Yu
            wrote on last edited by
            #5

            Try to use CRT function isdigit() or Windows API GetStringTypeEx().

            1 Reply Last reply
            0
            • G garfield185

              Gosh!! Thank you very mucho to both of you. As _AnShUmAn_ says, "Some things are hard to do UNTIL WE KNOW HOW TO DO THEM". That´s true... :-O

              _ Offline
              _ Offline
              _AnsHUMAN_
              wrote on last edited by
              #6

              Most Welcome. It's my pleasure.

              Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

              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