|
-
Jan 24th, 2005, 10:50 AM
#1
Thread Starter
Need-a-life Member
-
Jan 24th, 2005, 11:09 AM
#2
Re: Same UserControl/Form in 2 different Projects
have you tried making a project group with both projects included in it
rgds pete
-
Jan 24th, 2005, 11:13 AM
#3
Re: Same UserControl/Form in 2 different Projects
A project group is definitely the answer. You also need to create the User Control as a separate project in the group as an ActiveX control.
This world is not my home. I'm just passing through.
-
Jan 24th, 2005, 11:23 AM
#4
Thread Starter
Need-a-life Member
Re: Same UserControl/Form in 2 different Projects
I don't think a project group could be the answer. The Usercontrol MUST be part of the project because I will not distribute the Usercontrol as an OCX but as part of the compiled code. If the UserControl and the rest of the code were in two different projects I'll need to compile the Usercontrol and distribute the OCX as well.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jan 24th, 2005, 04:37 PM
#5
Re: Same UserControl/Form in 2 different Projects
 Originally Posted by Mc Brain
I don't think a project group could be the answer. The Usercontrol MUST be part of the project because I will not distribute the Usercontrol as an OCX but as part of the compiled code. If the UserControl and the rest of the code were in two different projects I'll need to compile the Usercontrol and distribute the OCX as well.
Project Group is definitely the answer (well, vbg isn't necessary but certainly better way to control all shared files) - all you have to do is to add that user control to your second project: right click on project explorer and select add -> file ... and point to your UserControl1.ctl. That's all - from now on both projects will share one user control.
It's a little inconvenient - every time you make changes in one project you'll have to confirm changes for all the rest of your projects sharing the same object (form, class, module, user control, etc) but other than that you'll benefit by having less objects over all.
Regards.
Last edited by RhinoBull; Jan 24th, 2005 at 04:45 PM.
-
Jan 24th, 2005, 05:29 PM
#6
Thread Starter
Need-a-life Member
Re: Same UserControl/Form in 2 different Projects
I think I'm not following. Can you post an example (as I did), please?
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Jan 25th, 2005, 01:01 PM
#7
Re: Same UserControl/Form in 2 different Projects
 Originally Posted by Mc Brain
Let's see the attached zip if you don't understand... the example will clarify itself.
I have two different projects: "Project1" and "Project2". Both projects have a form which uses an UserControl. Both, the Form and the UserControl are common for both projects. If you open project1.vbp and/or project2.vbp you see'll what I mean.
However, if you open the project2.vbp you'll realize that VB raises an error: "Class Project1.UserControl1 of control UserControl11 was not a loaded control class."
The explanation is pretty simple. Form1 has a reference to load the control Project1.UserControl1... but this project's name is Project2, so the usercontrol cannot be found. If I edited the Form1 to load the control Project2.UserControl2, this project2 would start "loading" correctly... but Project1 would start raising a similar error.
Is there any way to fix this?
Yes. You can take the usercontrol out of both projects, and make it part of its own project. Then compile the usercontrol into its own .OCX file, and make it Binary Compatible. That way, the GUID will always stay the same and both projects can load the user control correctly.
The downside to this, is you won't be able to step through the code of the usercontrol (usually this isn't a big problem).
Does that help, or do you need more info?
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|