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. edit control

edit control

Scheduled Pinned Locked Moved C / C++ / MFC
help
14 Posts 5 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.
  • A ashish dogra

    hi all i want to fix the limit of edit control it means that it can take only five digits that is 12345 after that we can not add any digit to it so tell me thanks Ashish Dogra MCA Noida

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

    Right click on the edit control and where you add a variable set the maximum and minimum values for the edit control. the variable associated with the edit control is of integer type Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

    1 Reply Last reply
    0
    • H Hamid Taebi

      See SetLimitText and LimitText_**


      **_

      whitesky


      A Offline
      A Offline
      ashish dogra
      wrote on last edited by
      #5

      i set this with int length=2; if(m_sh.GetLimitText()>length) { m_sh.SetLimitText(length); } but it doenot limit the text thanks Ashish Dogra MCA Noida

      R H 2 Replies Last reply
      0
      • A ashish dogra

        i set this with int length=2; if(m_sh.GetLimitText()>length) { m_sh.SetLimitText(length); } but it doenot limit the text thanks Ashish Dogra MCA Noida

        R Offline
        R Offline
        Ram Murali
        wrote on last edited by
        #6

        Under which function u wrote this code? try to write this code in the second line of OnInitDialog() function. Hope it will help. Regards, Ram

        A 1 Reply Last reply
        0
        • A ashish dogra

          i set this with int length=2; if(m_sh.GetLimitText()>length) { m_sh.SetLimitText(length); } but it doenot limit the text thanks Ashish Dogra MCA Noida

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

          Test this codem_Edit.LimitText(3);or m_Edit.SetLimitText(3);and answer me it work or not,please_**


          **_

          whitesky


          A 1 Reply Last reply
          0
          • R Ram Murali

            Under which function u wrote this code? try to write this code in the second line of OnInitDialog() function. Hope it will help. Regards, Ram

            A Offline
            A Offline
            ashish dogra
            wrote on last edited by
            #8

            sir thanks for reply but it will not work in oninitdialog() function Ashish Dogra MCA Noida

            R 1 Reply Last reply
            0
            • H Hamid Taebi

              Test this codem_Edit.LimitText(3);or m_Edit.SetLimitText(3);and answer me it work or not,please_**


              **_

              whitesky


              A Offline
              A Offline
              ashish dogra
              wrote on last edited by
              #9

              i try this code in oninitdialog function but not work Ashish Dogra MCA Noida

              H 2 Replies Last reply
              0
              • A ashish dogra

                sir thanks for reply but it will not work in oninitdialog() function Ashish Dogra MCA Noida

                R Offline
                R Offline
                Ram Murali
                wrote on last edited by
                #10

                CEdit* ed = (CEdit*)GetDlgItem(IDC_EDIT1); //replace the IDC_EDIT1 with the properties ID of the edit box ed->LimitText(5); Try this!!!!!!!!!!! Regards, Ram

                1 Reply Last reply
                0
                • A ashish dogra

                  i try this code in oninitdialog function but not work Ashish Dogra MCA Noida

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

                  But i tested this code and it work how you to use_**


                  **_

                  whitesky


                  A 1 Reply Last reply
                  0
                  • A ashish dogra

                    i try this code in oninitdialog function but not work Ashish Dogra MCA Noida

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

                    Test this code,its working

                    CEdit m_Edit;//Declare in class not function
                    m_Edit.Create(WS_CHILD|WS_VISIBLE,CRect(0,0,100,23),this,1);

                    m_Edit.LimitText(3);
                    
                    1 Reply Last reply
                    0
                    • H Hamid Taebi

                      But i tested this code and it work how you to use_**


                      **_

                      whitesky


                      A Offline
                      A Offline
                      ashish dogra
                      wrote on last edited by
                      #13

                      i want to tell you on thing that i enter values in edit control from buttons which are on the dialog box i have ten buttins and when i press buttons values appear on edit control. Ashish Dogra MCA Noida

                      H 1 Reply Last reply
                      0
                      • A ashish dogra

                        i want to tell you on thing that i enter values in edit control from buttons which are on the dialog box i have ten buttins and when i press buttons values appear on edit control. Ashish Dogra MCA Noida

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

                        well,when you want to insert your values to editbox you can check length values before insert_**


                        **_

                        whitesky


                        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