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. [MFC] TextBox

[MFC] TextBox

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
8 Posts 6 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.
  • T Offline
    T Offline
    torNAdE
    wrote on last edited by
    #1

    Hi, i have a text Box in my form. mu aim is to force the user to type just numbers in that textBox.But i dont know how to do that. So some plz could help me? i Use the MFC. thank you.

    G N H 3 Replies Last reply
    0
    • T torNAdE

      Hi, i have a text Box in my form. mu aim is to force the user to type just numbers in that textBox.But i dont know how to do that. So some plz could help me? i Use the MFC. thank you.

      G Offline
      G Offline
      georgeraafat
      wrote on last edited by
      #2

      You can use the ES_NUMBER style when creating the control. If the IDE does not expose this style, edit the .rc manually and add it. gmileka

      L 1 Reply Last reply
      0
      • G georgeraafat

        You can use the ES_NUMBER style when creating the control. If the IDE does not expose this style, edit the .rc manually and add it. gmileka

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        georgeraafat wrote:

        If the IDE does not expose this style, edit the .rc manually and add it.

        Wait, wouldn't the be #define in a header file? :confused:


        "What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum led mike

        G 1 Reply Last reply
        0
        • T torNAdE

          Hi, i have a text Box in my form. mu aim is to force the user to type just numbers in that textBox.But i dont know how to do that. So some plz could help me? i Use the MFC. thank you.

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          right click on the edit box->Take properties->Take Style tab-> In it u can find a check box labled Number-> Check it nave

          A 1 Reply Last reply
          0
          • L led mike

            georgeraafat wrote:

            If the IDE does not expose this style, edit the .rc manually and add it.

            Wait, wouldn't the be #define in a header file? :confused:


            "What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum led mike

            G Offline
            G Offline
            georgeraafat
            wrote on last edited by
            #5

            Yes - ES_NUMBER is defined in winuser.h. The .rc files can include headers. gmileka

            1 Reply Last reply
            0
            • N Naveen

              right click on the edit box->Take properties->Take Style tab-> In it u can find a check box labled Number-> Check it nave

              A Offline
              A Offline
              Anu_Bala
              wrote on last edited by
              #6

              But by checking the box,we cannot include the decimal points...I have the same problem.

              N 1 Reply Last reply
              0
              • A Anu_Bala

                But by checking the box,we cannot include the decimal points...I have the same problem.

                N Offline
                N Offline
                Naveen
                wrote on last edited by
                #7

                In that case derive a class from CEdit and overide the WM_CHAR message.. Inside that function u can prevent what ever characters u want(by not calling the CEdit::OnChar() from that function ) nave

                1 Reply Last reply
                0
                • T torNAdE

                  Hi, i have a text Box in my form. mu aim is to force the user to type just numbers in that textBox.But i dont know how to do that. So some plz could help me? i Use the MFC. thank you.

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  CEdit m_Edit; m_Edit.Create(ES_NUMBER|WS_CHILD|WS_VISIBLE|WS_BORDER,CRect(0,0,100,23),this,1); m_Edit.SetWindowText("123"); ---------------------------- m_Edit.ModifyStyle(0,ES_NUMBER); or change Number (ES_NUMBER) to true in window property form your Editbox

                  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