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 to make your edit control accept only capital letters

how to make your edit control accept only capital letters

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

    Hi there, I wish to make my edit control accept only capital letters in combination with numbers. The member variable (m_confirmation_num) for that control is a CString with max characters of 5. That string later gets converted to a UINT conf_num. Initially m_confirmation is set to NULL and m_conf_num to 0. The edit control is defaulted to "00000" when the dialog box is first opened. With CAPS LOCK on or OFF, the edit control accepts only capital letters. This is what I want but why does it do that. This only happens with the following set up but for cases where I do not want the zeroes to display in the field, it accepts lowercase. Is there a way to make the edit control accept only capital letters? Or have the lowercase changed to uppercase upon user input? And is there a function that checks to see if a char is uppper or lowercase? Thanks.

    T V M 3 Replies Last reply
    0
    • E elephantstar

      Hi there, I wish to make my edit control accept only capital letters in combination with numbers. The member variable (m_confirmation_num) for that control is a CString with max characters of 5. That string later gets converted to a UINT conf_num. Initially m_confirmation is set to NULL and m_conf_num to 0. The edit control is defaulted to "00000" when the dialog box is first opened. With CAPS LOCK on or OFF, the edit control accepts only capital letters. This is what I want but why does it do that. This only happens with the following set up but for cases where I do not want the zeroes to display in the field, it accepts lowercase. Is there a way to make the edit control accept only capital letters? Or have the lowercase changed to uppercase upon user input? And is there a function that checks to see if a char is uppper or lowercase? Thanks.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      see in the edit box properties in design editor...

      E 1 Reply Last reply
      0
      • E elephantstar

        Hi there, I wish to make my edit control accept only capital letters in combination with numbers. The member variable (m_confirmation_num) for that control is a CString with max characters of 5. That string later gets converted to a UINT conf_num. Initially m_confirmation is set to NULL and m_conf_num to 0. The edit control is defaulted to "00000" when the dialog box is first opened. With CAPS LOCK on or OFF, the edit control accepts only capital letters. This is what I want but why does it do that. This only happens with the following set up but for cases where I do not want the zeroes to display in the field, it accepts lowercase. Is there a way to make the edit control accept only capital letters? Or have the lowercase changed to uppercase upon user input? And is there a function that checks to see if a char is uppper or lowercase? Thanks.

        V Offline
        V Offline
        valikac
        wrote on last edited by
        #3

        One solution is WM_CHAR message. Kuphryn

        1 Reply Last reply
        0
        • T toxcct

          see in the edit box properties in design editor...

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

          Duh. I've looked at the properties but somehow overlooked it. Thanks a lot!

          1 Reply Last reply
          0
          • E elephantstar

            Hi there, I wish to make my edit control accept only capital letters in combination with numbers. The member variable (m_confirmation_num) for that control is a CString with max characters of 5. That string later gets converted to a UINT conf_num. Initially m_confirmation is set to NULL and m_conf_num to 0. The edit control is defaulted to "00000" when the dialog box is first opened. With CAPS LOCK on or OFF, the edit control accepts only capital letters. This is what I want but why does it do that. This only happens with the following set up but for cases where I do not want the zeroes to display in the field, it accepts lowercase. Is there a way to make the edit control accept only capital letters? Or have the lowercase changed to uppercase upon user input? And is there a function that checks to see if a char is uppper or lowercase? Thanks.

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            This is built-in: ES_UPPERCASE :)

            --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

            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