Es_number

This is a discussion on Es_number within the Windows Programming forums, part of the Platform Specific Boards category; In my text box i want the user to be able to enter in something like 1.2 or -1.5 but ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    215

    Es_number

    In my text box i want the user to be able to enter in something like 1.2 or -1.5 but no letters. Is there something to allow me to do that because ES_NUMBER only lets the user enter in numerals.

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I'm not familiar with ES_NUMBER - what language are you using? If I knew the language I could probably write you more specific code. Maybe this could help:

    If you could find a way to recieve each character either before or as soon as it is added to the text box, you could check it. Maybe do a series of if statements (keeping this as language-unspecific as possible) to find out if it is a valid character, like a number, a . or a - (or you may decide to allow , also). If it is, just proceed as normal. If it isn't either block it from going into the text box or if it's already there, remove, and then read the next character.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    215
    im doing Win32 programming in C

  4. #4
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Adrianxw provides a sample of subclassing the edit control here:
    Edit controls and numbers

    Search for more samples here:
    http://cboard.cprogramming.com/searc...searchid=46310

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21