[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,
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
Re: User Controls dont copy, when Form copied into another project
I was copying the frm and the frx files
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.
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
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
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?
Re: User Controls dont copy, when Form copied into another project
It came from PSC
isButton
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.
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 :thumb:, 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.
Re: User Controls dont copy, when Form copied into another project
Quote:
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.
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.