Open & Close files in a program - VB.net (2005)

  • Thread starter Thread starter 22Pom
  • Start date Start date
2

22Pom

Hi All,

This is all new to me so please be patient with me.

What I have is a very large 'Al-In-One' program, not yet complete, that has
over 70 Forms/Modules/Classes in it and needs to be broken up into smaller
programs/modules that can be called from the main program. I understand that
I would need to, via a Click Button to close one part down and open the new
section, but how.

This is where I get stuck, I really have no idea as to how to do this. Can
anyone offer up a way of doing this.

Thank You

22Pom
 
Are you trying to learn how to divide a single project solution (exe) into a
multi-project solution with one or more executable projects and one or more
dll projects?

Alternatively, are you trying to learn how to create a multi-document
interface (MDI) application?

Sorry, I could not figure this out from your post.
 
Hi Family Tree Mike,

Thank you for your responses and I'll try to answer you correctly.

I have several Modules and Classes that have common code used by other parts
of the program and more can be done in this area, I'm sure.

My program consists of 4 main product groups each of which has 5 sub
products and as you proceed the screen is closed off. In addition to these I
have forms that open a PDF style catalogue for each product.

Now each product has an entry screen where the user places their
requirements and after clicking to proceed comes back with various
selections. From this list the user closes this off and moves forward to the
next screen.

This new screen allows for Printing the data or moving onto a dimensional
data screen, which also has a printing area. Some of these screens are
common, but it still increases the overall number of Forms, etc. Each screen
has buttons to allow Exit the program or Return to a previous screen, each
time the screen is closed off and the new one opened.

All of these come under the main programs name. So I start a new project and
just keep adding forms etc to the project. This, I beleive, is where my
problem lies and I don't know how to create smaller blocks and have them
linked to the main.

Best Rgds
 
OK, that helps understand your goal. You should probably have a look at
this link: http://msdn.microsoft.com/en-us/library/23x5fk78.aspx. It gives
an overview of multiproject solutions.

The way I see it, you could have the project for the main application, and
four class libraries, one for each of the product groups. Others might
break up the libraries at the sub-product level, giving 20 libraries. There
is really no right or wrong answer here other than the items (forms,
classes, modules) form a logical grouping if they are in the same dll.

I believe you currently have a single project in your solution. To add a
product group library, select "File" then "New Project". For the project
type, select "Class Library". The name can be anything that signifies to
you that it pertains to a particular product group. Before clicking "OK",
make sure that the choice for "Solution" in the dropdown says "Add to
Solution".

Now you can move some of the forms, classes and modules out of the main
project to your dll project. It is likely you will need to add
System.Windows.Forms as a reference to your dll project as it is not added
by default.

When you move your forms and such out of your main project, you should see
errors about missing or undefined types. Those should be fixed by adding a
reference in your main project to the class library project. On the "Add
Reference" dialog, you will see a tab called "Projects" where you can point
to the new project.

The last step is that you will need to add an imports statement at the top
for the namespace from your new library so that the new namespace is
resolved.

Then you would do these steps for each new library you want to create.

Of course, make sure you back up your current solution folder so you can
always get back to the current way you have things!

Hope this helps.
 
Hi Family Tree Mike,

That helps a lot. As I said right at the beginning, this is all new to me
and by going through the process you outline will help me understand things
better than just dumping code into a program. I will also investigate the
link offered to see what that offers. I suspect that I will Have to spend
lots of time and receive heaps of trouble along the way but thats the only
way of learning things and making them stick in the Grey Matter memory banks.

Thanks again,
Best Rgds,
22Pom
 
Back
Top