Results 1 to 14 of 14

Thread: Copy all properties from Form to other Form

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Copy all properties from Form to other Form

    Hi

    What way to copy /clone all properties from a form to other form in same project


    tia

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Copy all properties from Form to other Form

    Not sure what you are trying to do.

    In the IDE ou can make a copy of the form by saving it then renaming it and save as a different filename then add the original to the project.

    At run time you can launch a clone of the form by creating a new instance of it

    Code:
    Dim MyNewForm as Form
    Set MyNewForm=New MyExistingForm
    MyNewForm.Show

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Copy all properties from Form to other Form

    Not really a "clone" as such but a new instance of the same Form class. People don't always realize a VB6 Form is both a class and a predeclared instance with the same name assigned to both.

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Copy all properties from Form to other Form

    Well you can't copy all properties otherwise you will have naming conflicts


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  5. #5
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,272

    Re: Copy all properties from Form to other Form

    Quote Originally Posted by jmsrickland View Post
    Well you can't copy all properties otherwise you will have naming conflicts
    If that were true you couldn't have Command1 on more than one form...which you can!
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Copy all properties from Form to other Form

    JMS-----Did you try what DM said? I do it all the time in the IDE....as a matter of a fact, I ALSO create a NEW form, copy-paste any or all of the controls to it from the original form, AND IF I WANT, I copy/paste the associated code as well (making changes a necessary for the 2nd form name vice the original.
    I also copy a form using windows explorer from one project to another (brings in all contols and code, of course).

  7. #7
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Copy all properties from Form to other Form

    The question is Copy all properties from Form to other Form so I assume OP means the properties of the Form which includes the name of the Form


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  8. #8
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Copy all properties from Form to other Form

    A S S U M E. I didn't make THAT assumption (the name of the form)!

    OP....you satisfied with DM's response(s)?

    Sammi

  9. #9
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Copy all properties from Form to other Form

    Well the name of course must be different as there can not be two with the same name plus there would be no point in having the second form anyway if it had the same name there would be no way to identify it from the other one assuming of course the IDE would let you do it in the first place.

    In any case it is hard to say for sure what the OP is really wanting to do, maybe the question has been answered and maybe not.

  10. #10
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Copy all properties from Form to other Form

    Quote Originally Posted by SamOscarBrown View Post
    A S S U M E. I didn't make THAT assumption (the name of the form)!

    OP....you satisfied with DM's response(s)?

    Sammi
    Why not? Name is a property of a Form but Command1 is not a property

    If the OP means Form properties then that includes Name but if OP means child windows of a Form then that includes Command1.

    Depends on what OP really means


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  11. #11
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,622

    Re: Copy all properties from Form to other Form

    Because as DM points out, common sense would tell us (trying to help OP) that you can't have two identically named forms, like you can't have two buttons named Command1 on the same form.

  12. #12
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,272

    Re: Copy all properties from Form to other Form

    I assumed that the OP was asking about copying a form with all of its controls but we'll see, I suppose!
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  13. #13
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Copy all properties from Form to other Form

    I also assume that but my statement was based entirely on what OP said, common sense or not.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  14. #14
    Frenzied Member
    Join Date
    Apr 2012
    Posts
    1,272

    Re: Copy all properties from Form to other Form

    Quote Originally Posted by jmsrickland View Post
    I also assume that but my statement was based entirely on what OP said, common sense or not.
    Fair point. There's way too much second-guessing that goes on here due to poorly-asked questions...
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

Tags for this Thread

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