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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. a problem!!!!

a problem!!!!

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
9 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.
  • S Offline
    S Offline
    smartymanav
    wrote on last edited by
    #1

    hi all!! i am facing a problem i am bnot able to understand!!! consider the foll codes in my project CPrjView pview; long c1=pview.ctr; these r lines written in a c.cpp and it includes the PrjView.h file ctr is a public variable of The CPrjView class of type long i am not underrstanding that why c1 is getting a very strange value!!! for ef ctr is 3 and still c1 is getiing a value like -85899346 also i am not able ti change the values of variables in this c.cpp for eg if i write pview.ctitle="ABC"; ctitle is a public variable of CPrjView class of type CString it is giving a run time error... please help!!!1

    T C 2 Replies Last reply
    0
    • S smartymanav

      hi all!! i am facing a problem i am bnot able to understand!!! consider the foll codes in my project CPrjView pview; long c1=pview.ctr; these r lines written in a c.cpp and it includes the PrjView.h file ctr is a public variable of The CPrjView class of type long i am not underrstanding that why c1 is getting a very strange value!!! for ef ctr is 3 and still c1 is getiing a value like -85899346 also i am not able ti change the values of variables in this c.cpp for eg if i write pview.ctitle="ABC"; ctitle is a public variable of CPrjView class of type CString it is giving a run time error... please help!!!1

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

      doing CPrjView pview; calls the default constructor CPrjView::CPrjView(). be sure you're correctly initializing ctr into this constructor, because it seems to be nowhere else getting a value... maybe you think it contains 3, but it doesn't. did you use the debugger ? what happens if you do the following ?

      pview.ctr = 3;
      long c1 = pview.ctr;


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      S 2 Replies Last reply
      0
      • S smartymanav

        hi all!! i am facing a problem i am bnot able to understand!!! consider the foll codes in my project CPrjView pview; long c1=pview.ctr; these r lines written in a c.cpp and it includes the PrjView.h file ctr is a public variable of The CPrjView class of type long i am not underrstanding that why c1 is getting a very strange value!!! for ef ctr is 3 and still c1 is getiing a value like -85899346 also i am not able ti change the values of variables in this c.cpp for eg if i write pview.ctitle="ABC"; ctitle is a public variable of CPrjView class of type CString it is giving a run time error... please help!!!1

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        smartymanav wrote: for ef ctr is 3 and still c1 is getiing a value like -85899346 Never define a variable anywhere without giving it a default value. Otherwise, this is what you get. I think the other response covers your more specific problem. Christian Graus - Microsoft MVP - C++

        1 Reply Last reply
        0
        • T toxcct

          doing CPrjView pview; calls the default constructor CPrjView::CPrjView(). be sure you're correctly initializing ctr into this constructor, because it seems to be nowhere else getting a value... maybe you think it contains 3, but it doesn't. did you use the debugger ? what happens if you do the following ?

          pview.ctr = 3;
          long c1 = pview.ctr;


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          S Offline
          S Offline
          smartymanav
          wrote on last edited by
          #4

          thanks a lot!!!!!!!!!!1 it solved my prob....i need practice!!!!!! thanks but can u also advice me something i wan t to permanently save the changes made in an array of strings..... i tried to use databse for it but cud not...do u know hot to get data from multiple tables in different variables thanks again

          T 1 Reply Last reply
          0
          • S smartymanav

            thanks a lot!!!!!!!!!!1 it solved my prob....i need practice!!!!!! thanks but can u also advice me something i wan t to permanently save the changes made in an array of strings..... i tried to use databse for it but cud not...do u know hot to get data from multiple tables in different variables thanks again

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

            what database do you use exactly ? if MS SQL Server, ADO is the best way (i consider you know about SQL though - see Carlos Antollini's ADO Classes[^] for that). if you use simple files, it will depend on how you format them... cheers,


            TOXCCT >>> GEII power
            [toxcct][VisualCalc]

            S 1 Reply Last reply
            0
            • T toxcct

              doing CPrjView pview; calls the default constructor CPrjView::CPrjView(). be sure you're correctly initializing ctr into this constructor, because it seems to be nowhere else getting a value... maybe you think it contains 3, but it doesn't. did you use the debugger ? what happens if you do the following ?

              pview.ctr = 3;
              long c1 = pview.ctr;


              TOXCCT >>> GEII power
              [toxcct][VisualCalc]

              S Offline
              S Offline
              smartymanav
              wrote on last edited by
              #6

              thanks a lot it solved my prob thanks again!!! but can u tell me another thing plz suggest me a medthod to permanently save the changes made during run time into a array of strings in vc++ i tried to use database but am unable as i am already using a database to get data into a form in the same project do u know how to get data from multiple tables in the same project into diff forms... thanks again

              1 Reply Last reply
              0
              • T toxcct

                what database do you use exactly ? if MS SQL Server, ADO is the best way (i consider you know about SQL though - see Carlos Antollini's ADO Classes[^] for that). if you use simple files, it will depend on how you format them... cheers,


                TOXCCT >>> GEII power
                [toxcct][VisualCalc]

                S Offline
                S Offline
                smartymanav
                wrote on last edited by
                #7

                i am using access datase linking by odbc.... is ado better???or it is possible to do so in odbs using access database acually the thing is i am already using a database for retrieving data in a form in this same project.... i now want to use another table in the same database for retriving data in to another form plz help or suggest a diff way thanks

                T C 2 Replies Last reply
                0
                • S smartymanav

                  i am using access datase linking by odbc.... is ado better???or it is possible to do so in odbs using access database acually the thing is i am already using a database for retrieving data in a form in this same project.... i now want to use another table in the same database for retriving data in to another form plz help or suggest a diff way thanks

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

                  sorry, i don't know at all how to use access DB... you should ask this in a separate thread... (search also on codeproject && google ; there are certainly many useful articles on the subject)...


                  TOXCCT >>> GEII power
                  [toxcct][VisualCalc]

                  1 Reply Last reply
                  0
                  • S smartymanav

                    i am using access datase linking by odbc.... is ado better???or it is possible to do so in odbs using access database acually the thing is i am already using a database for retrieving data in a form in this same project.... i now want to use another table in the same database for retriving data in to another form plz help or suggest a diff way thanks

                    C Offline
                    C Offline
                    Cool Ju
                    wrote on last edited by
                    #9

                    Hi, U can use CDaoDatabase and CDaoRecordset Classes to handle databases. U can directly open access(.mdb) databases and also thro odbc. These classes support both of them. U can also ADO. it is better than DAO. Refer MSDN for more details. Bye Cool Ju:cool:

                    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