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. number validation

number validation

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 Posts 4 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.
  • S Offline
    S Offline
    slah
    wrote on last edited by
    #1

    i have an edit control on dialog box and i am not using MFC, i want to validate that only numbers should be entered in the field. what is the possible way out. help me out PLZ

    C A 2 Replies Last reply
    0
    • S slah

      i have an edit control on dialog box and i am not using MFC, i want to validate that only numbers should be entered in the field. what is the possible way out. help me out PLZ

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

      You're better off doing it yourself anyhow. Handle WM_KEYDOWN in the edit control, and then you can do your own validation. You can set the number style, or if you need negative numbers or decimals, you can deal with that in the same message. Christian come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002

      PJ ArendsP 1 Reply Last reply
      0
      • S slah

        i have an edit control on dialog box and i am not using MFC, i want to validate that only numbers should be entered in the field. what is the possible way out. help me out PLZ

        A Offline
        A Offline
        Ancient Dragon
        wrote on last edited by
        #3

        In the resource editor with the dialog box displayed, right click the edit control, select properties, select the styles tab, then check the Number checkbox. This will allow only the digits 0-9.

        1 Reply Last reply
        0
        • C Christian Graus

          You're better off doing it yourself anyhow. Handle WM_KEYDOWN in the edit control, and then you can do your own validation. You can set the number style, or if you need negative numbers or decimals, you can deal with that in the same message. Christian come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002

          PJ ArendsP Offline
          PJ ArendsP Offline
          PJ Arends
          wrote on last edited by
          #4

          Christian Graus wrote: Handle WM_KEYDOWN in the edit control Actually, I think he would be better off handling the EN_UPDATE notification, that way he can properly validate any text that is pasted into the edit control. --- CPUA 0x5041 Sonork 100.11743 Chicken Little Within you lies the power for good - Use it!

          Within you lies the power for good; Use it!

          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