Results 1 to 12 of 12

Thread: [RESOLVED] User Controls dont copy, when Form copied into another project

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Resolved [RESOLVED] User Controls dont copy, when Form copied into another project

    I have a Form with some user controls on it.
    When the form is copied into another project, the user controls don't come with it.
    I get picture boxes instead.

    My current form has a user control frame, and it contains some user control buttons.
    None of them copy across properly.

    But even on my simpler Forms, with no frame, just user control buttons, I get the same problem.

    (I have previously included the user controls into the target project)

    If there is trick to it, I would appreciate hearing about it.

    Thanks,
    Last edited by RobCrombie; Aug 29th, 2006 at 01:07 PM.
    Rob C

  2. #2
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: User Controls dont copy, when Form copied into another project

    how are you copying the form?

    if you just copy the .frm file then it should work fine

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: User Controls dont copy, when Form copied into another project

    I was copying the frm and the frx files
    Rob C

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: User Controls dont copy, when Form copied into another project

    Here is a link to the button user control -
    isButton

    It is a great control and is worth checking out.

    To replicate my problem -
    Create a new project, and include the user control into the project.
    Then go to the other folder (where you extracted the example above), and copy the smaller form (frmDefaultCancelProps) into your new project.
    There will be an error log, and the button will be replaced with an empty picture box.
    Rob C

  5. #5
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: User Controls dont copy, when Form copied into another project

    you have to ensure that the new project already has a reference to the component before you add the form

    Ctrl+T - check the appropriate one(s) - then add your form

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: User Controls dont copy, when Form copied into another project

    I already have the ctl files included in the project as user controls (prior to me attempting to add the copied form).
    Do you mean I should have a reference as well ?
    I looked in the original project (which had the original form with the controls working on it). I cannot see any reference to the User Controls, in the 'Project References' or in the 'Project Components' menus.
    They are in the Toolbox of both projects
    Rob C

  7. #7
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: User Controls dont copy, when Form copied into another project

    Which user control are you using? you made that control or downloaded it from somewhere?

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: User Controls dont copy, when Form copied into another project

    It came from PSC
    isButton
    Rob C

  9. #9
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: User Controls dont copy, when Form copied into another project

    frmDefaultCancelProps references isButtonTest.isButton - isButtonTest is the library (the Project Name) and isButton is the class.

    If you add the user control to a new project the Library changes. It would be something like Project1.isButton

    2 choices
    1) change the name of your project to isButtonTest
    2) change all occurrences of isButtonTest in the frm file (using notepad) to the name of the new project before adding the form to the project.
    Last edited by brucevde; Aug 29th, 2006 at 03:50 PM.

  10. #10
    PowerPoster jcis's Avatar
    Join Date
    Jan 2003
    Location
    Argentina
    Posts
    4,430

    Re: User Controls dont copy, when Form copied into another project

    Quote Originally Posted by brucevde
    2) change all occurrences of isButtonTest in the frm file (using notepad) to the name of the new project before adding the form to the project.
    Nice Bruce , 1 question, is there any way to produce the OCX version of the usercontrol having that? the author says its in his homepage but it isnt.

  11. #11
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: User Controls dont copy, when Form copied into another project

    is there any way to produce the OCX version of the usercontrol having that?
    Start a new ActiveX Control project.
    Remove the default user control that is automatically added to the project.
    Add the isButton user control.
    Change the Project name to whatever you want.
    Change the isButton.Public property to True.
    Compile.

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2002
    Location
    AUSTRALIA
    Posts
    603

    Re: User Controls dont copy, when Form copied into another project

    B R I L L I A N T

    That was the problem, and a perfect solution.

    Many thanks, you have saved me many hours of recreating a form that had a full size user control frame, filled with many isButtons and VB's intrinsic controls.

    I will sing about you round the camp fires for years to come.
    Rob C

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