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. retreive data from text box in vc++ 6

retreive data from text box in vc++ 6

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
11 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.
  • I Offline
    I Offline
    identity_85
    wrote on last edited by
    #1

    how to get the input data (text) from text box in mfc dialog based application in v c++ 6

    S N N 3 Replies Last reply
    0
    • I identity_85

      how to get the input data (text) from text box in mfc dialog based application in v c++ 6

      S Offline
      S Offline
      see me
      wrote on last edited by
      #2

      GetWindowText (CString& rString) const

      Dream bigger... Do bigger...Expect smaller aji

      I 1 Reply Last reply
      0
      • I identity_85

        how to get the input data (text) from text box in mfc dialog based application in v c++ 6

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

        CString csText; GetDlgItemText( IDC_EDIT1, csText );// here IDC_EDIT1 is the id of the edit control

        nave

        1 Reply Last reply
        0
        • I identity_85

          how to get the input data (text) from text box in mfc dialog based application in v c++ 6

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          identity_85 wrote:

          how to get the input data (text) from text box in mfc dialog based application in v c++ 6

          GetDlgItemText


          Nibu thomas A Developer Programming tips[^]  My site[^]

          1 Reply Last reply
          0
          • S see me

            GetWindowText (CString& rString) const

            Dream bigger... Do bigger...Expect smaller aji

            I Offline
            I Offline
            identity_85
            wrote on last edited by
            #5

            i want it as long not string?????????????

            _ U 2 Replies Last reply
            0
            • I identity_85

              i want it as long not string?????????????

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

              Take it as string convert it to long

              char * str=new char[100];
              GetDlgItemText (IDC_EDIT1,str,100);
              long l;
              l=atol (str);
              

              Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

              S 1 Reply Last reply
              0
              • I identity_85

                i want it as long not string?????????????

                U Offline
                U Offline
                User 3037427
                wrote on last edited by
                #7

                Map it to some variable (ex: m_edit) While mapping it select long as its type. In the code use the following lines long val; UpdateData(); val=m_edit

                1 Reply Last reply
                0
                • _ _AnsHUMAN_

                  Take it as string convert it to long

                  char * str=new char[100];
                  GetDlgItemText (IDC_EDIT1,str,100);
                  long l;
                  l=atol (str);
                  

                  Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                  S Offline
                  S Offline
                  see me
                  wrote on last edited by
                  #8

                  _AnShUmAn_ wrote:

                  GetDlgItemText (IDC_EDIT1,str,100);

                  Hey this will cause error:~ u need to modify this to GetDlgItemText (IDC_EDIT1,(LPTSTR)str,100); :)

                  Dream bigger... Do bigger...Expect smaller aji

                  _ 1 Reply Last reply
                  0
                  • S see me

                    _AnShUmAn_ wrote:

                    GetDlgItemText (IDC_EDIT1,str,100);

                    Hey this will cause error:~ u need to modify this to GetDlgItemText (IDC_EDIT1,(LPTSTR)str,100); :)

                    Dream bigger... Do bigger...Expect smaller aji

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

                    see me wrote:

                    Hey this will cause error

                    And Why so: LPTSTR-An LPWSTR if UNICODE is defined, an LPSTR otherwise. Did you try using the code that I gave.

                    Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                    S 1 Reply Last reply
                    0
                    • _ _AnsHUMAN_

                      see me wrote:

                      Hey this will cause error

                      And Why so: LPTSTR-An LPWSTR if UNICODE is defined, an LPSTR otherwise. Did you try using the code that I gave.

                      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                      S Offline
                      S Offline
                      see me
                      wrote on last edited by
                      #10

                      Yes...If unicode is not defined then ur code is ok.:) but wen unicode is defined then it will cause error.:doh: and one more thing you need to mention that, call delete of str at the end.:~

                      Dream bigger... Do bigger...Expect smaller aji

                      _ 1 Reply Last reply
                      0
                      • S see me

                        Yes...If unicode is not defined then ur code is ok.:) but wen unicode is defined then it will cause error.:doh: and one more thing you need to mention that, call delete of str at the end.:~

                        Dream bigger... Do bigger...Expect smaller aji

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

                        see me wrote:

                        GetWindowText (CString& rString) const

                        Thanks for your comment. But just have a look at your post:sigh:. Shouldn't it be: CString str; m_editBox.GetWindowText(str); No personnel issues but just to.......:-D say that we don't post the code here that is always optimized.

                        Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

                        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