How to rename a class in VbClassic: ---- Doing the RenameClass refactoring involves more than just a global search and replace when you're using VbClassic: Here's a quick and easy way to do it: 1. Copy the original class into a new .cls file 1. Do the search-replace 1. Run the tests 1. Check in the new file 1. Delete the old file from the project 1. Check in the project file 1. Delete the old file from source control and the file system. The advantage is that once the new file is set up and working, you can do the rest without worrying about breaking anything. ''This will probably work better, in the presence of labels and other advanced usage, than renaming. Few source code control products are very good at handling rename operations. OTOH, it may be a little more difficult to see the history of changes to a given class.'' Oops, good point. ---- Here's a slightly more complex but more "air tight" way to do it -- particularly if your VersionControl software supports "rename" operations: 1. Ensure that you have write access to the class and all files that reference it. (Typically, this means that you must "check out" these files.) 2. In the class' properties, change the class' name. 3. Do a search and replace, changing the old class name to the new one. Typically, you'll search and replace the whole of the current project. If it's an externally visible class or interface, you'll have to search and replace in other projects. At this point the system should compile and successfully pass all UnitTest''''''s. But the file name for the class no longer matches its class name. When checking in your changes, a good approach is... 1. Remember to check in the project (.vbp) file last. 2. Check in the class whos name is changing. You can enter checkin comments that you're changing the class' name. 3. Delete the class from the project. 4. Rename the class in the source code control system. 5. Rename the class in the file system. 6. Add the class back into the project. (Add -> Class Module, Existing, open the file with the new name) 7. When finished, check in the project file. ---- VbClassic will become confused when you check out files in the middle of a project-wide search: It will report that you've found all instances, when you really haven't. So, you'll either have to do another round of searching, or rely on another method, such as bookmarks or open windows to keep track of what files need to be checked out. A similar process can be used to rename projects, when project group files are being used. ----- In the instructions above, I've documented the "safe, sane, rational" way to do it. To be honest, I normally open the project file in Notepad or VIM and edit it by hand. -- JeffGrigg ----- CategoryRefactoring, CategoryVbClassic