Results 1 to 5 of 5

Thread: [RESOLVED] Copying and Renaming a Form in vb6

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2008
    Posts
    325

    Resolved [RESOLVED] Copying and Renaming a Form in vb6

    Occasionally, I need to make a copy of an existing form and add it to the same vb6 project. It never seems to work because the form always remembers its original name and the project gives me an error message that says " a form of that name already exists". Can someone please tell me how to accomplish this task. In this case I have a form that contains 75-80 percent of what I need.

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Copying and Renaming a Form in vb6

    Someone may know a better way but I copy it to a new project, rename it there, then add it back to the project I want with the new name using the existing tab.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Copying and Renaming a Form in vb6

    Quote Originally Posted by TysonLPrice
    Someone may know a better way but I copy it to a new project, rename it there, then add it back to the project I want with the new name using the existing tab.
    Yep, basically I open a new standard exe, load the file from the main project into it, rename it, do a SaveAs to the main project folder, close the new project, and load the newly saved and newly renamed form copy into my main project.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Copying and Renaming a Form in vb6

    I copy the files, rename them.... (both the frm and frx) ... then open the FRM in notepad... find all ocurences of the old name and change them the to the new name....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    3,969

    Re: Copying and Renaming a Form in vb6

    Another way when the form isn't too busy is to add a new form, highlight all the controls by clicking in the top corner, hold the mouse down, and drag the box over all the controls and let go. One of them will be highlighted in blue. Click on that one and then the copy function. That will capture all the controls at once. Then paste them onto the new form and copy and paste all the code from the old one into the new one. Then name it what you want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width