Wrox Programmer Forums
|
BOOK: Visual Basic 2005 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2005 Programmer's Reference by Rod Stephens; ISBN: 9780764571985
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2005 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2007, 01:08 PM
Authorized User
 
Join Date: Dec 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help! Its all gone horribly wrong!

Having found out how to do visual inheritance, I created some 20 classes that inherit from a base form in a new project.

I then tried to import all these, including the base form, into my existing project using "Project/Add existing items". All my inherited classes came in as if they were complete forms (1.e with a + in the solution explorer that reveals a designer and a resx) The project won't build because it says one or more of the controls (on the base form) are missing (presumably because it thinks they are complete forms in themselves). It actually says "The variable 'GroupBox1' is either undeclared or was never assigned."

So I then tried to add the other components from the original project to my new project, again with "Project/Add existing items". This time the forms in the original project have come across as three separate files - a vb, a resx and a designer.vb, and the forms have no visual components.

Any suggestions on how to merge these two projects successfully?

 
Old January 27th, 2007, 11:30 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

When you add the existing items, it seems to be copying the inherited forms into the current project's directory. Those forms are looking locally for the parent class and it's not there.

Instead make a class library and put the parent form there, along with any inherited forms that you want to use in other projects. Then in the second project, add a reference to the DLL. You should be able to create instances of the classes defined in the DLL and inherit from them.

Rod
RodStephens@vb-helper.com
Author of "Visual Basic 2005 Programmer's Reference"
http://www.vb-helper.com/vb_prog_ref.htm

Sign up for the free VB Helper Newsletters at http://www.vb-helper.com/newsletter.html
 
Old January 27th, 2007, 11:38 AM
Authorized User
 
Join Date: Dec 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Rod. I'll venture into the unknown waters of class libraries!

 
Old January 30th, 2007, 05:49 AM
Authorized User
 
Join Date: Dec 2006
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm now using code sharing instead (see my IDE topic)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help..What am I doing wrong... Brettvan1 VB.NET 2002/2003 Basics 2 October 18th, 2004 02:36 AM
Where did I go wrong??? ahc2inc VB.NET 2002/2003 Basics 3 September 28th, 2004 08:19 PM
What's wrong?Help! amu BOOK: Beginning ASP.NET 1.0 1 October 28th, 2003 08:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.