13 Replies - 21808 Views - Last Post: 10 May 2012 - 06:03 AM Rate Topic: -----

#1 jonrmoore  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 21-December 07

How can I copy a form in the same vb6 project?

Posted 21 December 2007 - 10:38 PM

I am trying to copy an existing form in vb6 and call it a different name. I don't want to recreate the form. I want to use formA in some conditions and formB in others. I used explorer to copy the form and gave it a different name but vb won't let me add it to the project. The the file name is different, the internal form name is the same I suppose.
Is This A Good Question/Topic? 0
  • +

#5 Nayana  Icon User is offline

  • DIC Hawk - 나야나 नयन:
  • member icon

Reputation: 31
  • View blog
  • Posts: 824
  • Joined: 14-November 07

Re: How can I copy a form in the same vb6 project?

Posted 22 December 2007 - 12:10 AM

You can create a new form. Go to the original form, press Ctrl-A, then Ctrl-C
(Select All, Copy)

Then go to the new form and press Ctrl-V (Paste)

You would need to copy any code seperately. Which is easy as well.

Why are you copying a form anyway?
Was This Post Helpful? 1

#6 ivan1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-May 12

Re: How can I copy a form in the same vb6 project?

Posted 04 May 2012 - 04:34 AM

TRY THE FOLLOWING STEPS.....

Attached image(s)

  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image
  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#7 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: How can I copy a form in the same vb6 project?

Posted 05 May 2012 - 09:35 AM

Alternatively, you can simply copy the .frm file to a different name (just copy the file, don't go into VB6), then open your project and add the new form to it.

You might find it interesting to open a .frm file in Notepad. :)

This post has been edited by BobRodes: 05 May 2012 - 09:36 AM

Was This Post Helpful? 0
  • +
  • -

#8 teamfive  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 30
  • Joined: 03-May 12

Re: How can I copy a form in the same vb6 project?

Posted 05 May 2012 - 10:08 PM

Hi there!
If you want to copy a form, you could just simply select all objects in there and copy it..
Then create a new form and paste it in there..
Thats just how I do it usually.. haha.. :D
Was This Post Helpful? 0
  • +
  • -

#9 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: How can I copy a form in the same vb6 project?

Posted 07 May 2012 - 06:15 AM

Alternatively, you can simply copy the .frm file to a different name (just copy the file, don't go into VB6), then open your project and add the new form to it.

Teamfive, your suggestion doesn't copy any of the code. Of course, you can copy all the code too, in an added step. But as I said to the OP, you might find it interesting to open a frm file with notepad. If you do, you'll see that it's just a text file, with definitions of all of the controls in the form followed by all the code in the form's code window. This means that you can simply copy the frm file to a new name, then go into your project and do an Add Existing Form to put it into your project.
Was This Post Helpful? 0
  • +
  • -

#10 ivan1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 04-May 12

Re: How can I copy a form in the same vb6 project?

Posted 08 May 2012 - 05:49 AM

go to a new vb6 then add your form. (ex: form1.frm)
change the name of the form then save as. (ex: form2.frm)
then after you save it as form2.frm right click again then click save form2.frm...
the nload it to your project...

there you have it......I will make my account on youtube so you can understand it.....
Was This Post Helpful? 0
  • +
  • -

#11 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: How can I copy a form in the same vb6 project?

Posted 08 May 2012 - 06:07 AM

LOL I just realized this is a five year old thread.

But Ivan, this still isn't the best way to do it. Again, .frm files are TEXT files. All you have to do is make a copy of the file (even do a save as) and add the copy to your project.

You raise up your head
And you ask, “Is this where it is?”
And somebody points to you and says
“It’s his”
And you say, “What’s mine?”
And somebody else says, “Where what is?”
And you say, “Oh my God
Am I here all alone?”

Signing off now...

This post has been edited by BobRodes: 08 May 2012 - 06:09 AM

Was This Post Helpful? 0
  • +
  • -

#12 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,771
  • Joined: 26-March 09

Re: How can I copy a form in the same vb6 project?

Posted 08 May 2012 - 11:36 PM

Not wanting to drag this 5 year old thread on longer than necessary, I personally use an add-in called MZTools, which has a "Copy Controls and Code" option which seems to work quite well.
Was This Post Helpful? 0
  • +
  • -

#13 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: How can I copy a form in the same vb6 project?

Posted 09 May 2012 - 06:32 AM

No doubt, it copies the .frm file, and adds a reference to it to the .vbp file. :)
Was This Post Helpful? 0
  • +
  • -

#14 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,771
  • Joined: 26-March 09

Re: How can I copy a form in the same vb6 project?

Posted 09 May 2012 - 08:02 AM

Not quite, you still need to add a new form manually, it just enables you to copy all controls and code behind them and paste them to the new form.
Was This Post Helpful? 0
  • +
  • -

#15 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: How can I copy a form in the same vb6 project?

Posted 09 May 2012 - 08:50 AM

Why is that an improvement on simply copying the .frm file (or doing a save as) and adding it to the project then?
Was This Post Helpful? 0
  • +
  • -

#16 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,771
  • Joined: 26-March 09

Re: How can I copy a form in the same vb6 project?

Posted 09 May 2012 - 02:27 PM

I didn't say it was an improvement, I just dropped it in as a way I've done it before now as everyone was expressing different ways of doing it.

It's not really something that I find needs to be done often anyway.
Was This Post Helpful? 0
  • +
  • -

#17 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: How can I copy a form in the same vb6 project?

Posted 10 May 2012 - 06:03 AM

Oh, all right then. No, it isn't, is it?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1