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. Add/Remove Operation is not possible because the code element is read only

Add/Remove Operation is not possible because the code element is read only

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
8 Posts 6 Posters 1 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.
  • L Offline
    L Offline
    Le rner
    wrote on last edited by
    #1

    Hi all, Actually i am new to VC2005. My problem is whenever i am trying to add any function say OnCtlColor to my class a message is displayed that Add/remove operation is not possible because the code element is read-only. I am not getting how to correct it... Can anybody help me in correcting it... Thanks in advance

    N M L 3 Replies Last reply
    0
    • L Le rner

      Hi all, Actually i am new to VC2005. My problem is whenever i am trying to add any function say OnCtlColor to my class a message is displayed that Add/remove operation is not possible because the code element is read-only. I am not getting how to correct it... Can anybody help me in correcting it... Thanks in advance

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

      the header and cpp file might me readonly. Remove the read only attribute of that files.

      nave [OpenedFileFinder]

      M 1 Reply Last reply
      0
      • L Le rner

        Hi all, Actually i am new to VC2005. My problem is whenever i am trying to add any function say OnCtlColor to my class a message is displayed that Add/remove operation is not possible because the code element is read-only. I am not getting how to correct it... Can anybody help me in correcting it... Thanks in advance

        M Offline
        M Offline
        Maxwell Chen
        wrote on last edited by
        #3

        Steps: 1. Switch to [Class View] tab, and highlight the class name you are going to add OnCtlColor. (It must be a CWnd based class) 2. Right-click at that name, and choose [Peoperties]. 3. You are lead to [Properties] tab. You will see an icon-only button which has the name [Messages]. Click that [Messages] button. 4. The view will list all the available messages including WM_CTLCOLOR. Then you know what to do. :-D

        Maxwell Chen

        1 Reply Last reply
        0
        • N Naveen

          the header and cpp file might me readonly. Remove the read only attribute of that files.

          nave [OpenedFileFinder]

          M Offline
          M Offline
          Maxwell Chen
          wrote on last edited by
          #4

          And sometimes it also happens when the .ncb file gets into crazy. Close the solution and re-open it should help.

          Maxwell Chen

          1 Reply Last reply
          0
          • L Le rner

            Hi all, Actually i am new to VC2005. My problem is whenever i am trying to add any function say OnCtlColor to my class a message is displayed that Add/remove operation is not possible because the code element is read-only. I am not getting how to correct it... Can anybody help me in correcting it... Thanks in advance

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I have experienced this bug in Visual Studio 2005 in several of my projects. Its very annoying and I hope it was fixed in 2008. I found a strange way to fix the bug but it works almost everytime for me. 1.) Open the header file and copy the entire contents of the header into the corresponding CPP file at the very top. 2.) Close Visual Studio 2005. 3.) Delete the Intellisense database with the extension .NCB 4.) Re-open Visual Studio 2005 and wait a few seconds for the Intellisense database to rebuild. 5.) Try to add your OnCtlColor message handler again. 6.) Copy and paste your header contents back into the .H file. Let me know if it works for you! -Randor (David Delaune)

            M W 2 Replies Last reply
            0
            • L Lost User

              I have experienced this bug in Visual Studio 2005 in several of my projects. Its very annoying and I hope it was fixed in 2008. I found a strange way to fix the bug but it works almost everytime for me. 1.) Open the header file and copy the entire contents of the header into the corresponding CPP file at the very top. 2.) Close Visual Studio 2005. 3.) Delete the Intellisense database with the extension .NCB 4.) Re-open Visual Studio 2005 and wait a few seconds for the Intellisense database to rebuild. 5.) Try to add your OnCtlColor message handler again. 6.) Copy and paste your header contents back into the .H file. Let me know if it works for you! -Randor (David Delaune)

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              That sequence fixes so many bugs that they should have put a big button on the UI that does the sequence automatically LOL Cheers, Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              1 Reply Last reply
              0
              • L Lost User

                I have experienced this bug in Visual Studio 2005 in several of my projects. Its very annoying and I hope it was fixed in 2008. I found a strange way to fix the bug but it works almost everytime for me. 1.) Open the header file and copy the entire contents of the header into the corresponding CPP file at the very top. 2.) Close Visual Studio 2005. 3.) Delete the Intellisense database with the extension .NCB 4.) Re-open Visual Studio 2005 and wait a few seconds for the Intellisense database to rebuild. 5.) Try to add your OnCtlColor message handler again. 6.) Copy and paste your header contents back into the .H file. Let me know if it works for you! -Randor (David Delaune)

                W Offline
                W Offline
                WilliamFalconerUK
                wrote on last edited by
                #7

                Randor wrote:

                I have experienced this bug in Visual Studio 2005 in several of my projects. Its very annoying and I hope it was fixed in 2008.

                I fear not... just had a similar problem myself in VS 2008, and deleting the .ncb fixed the issue here too. Cheers,

                Billy. MCPD Windows Developer "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                L 1 Reply Last reply
                0
                • W WilliamFalconerUK

                  Randor wrote:

                  I have experienced this bug in Visual Studio 2005 in several of my projects. Its very annoying and I hope it was fixed in 2008.

                  I fear not... just had a similar problem myself in VS 2008, and deleting the .ncb fixed the issue here too. Cheers,

                  Billy. MCPD Windows Developer "Duct tape is like the force, it has a light side, a dark side and it holds the universe together!" - Anonymous my holding page..more coming soon!

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Wow, looks like I posted that back in March 2008. I am also using VS2008 now and it seems that it happens less often but the problem has not gone away. It seems that it mostly happens in my very large C++ projects. I guess we can only hope that VS2010 will have permanently squashed this little annoyance. I am glad that the post helped you fix your issue. Best Wishes, -David Delaune

                  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