VB.net 03, run one project from another

G

Guest

I am incorporating three existing programs into a new "all in one" program. I
have added the three projects to the new all in one project. How do I
instruct the new initial menu to launch the main menu in each one? I have
tried using the DIM statement with .ShowDialog, however, the forms are not
recognized as they are listed in seperate projects.

Please advise.

Thanks,
Dr. S.
 
S

Scott M.

The "main" project in your new solution will need a reference to the other
project it wants to utilize. Then the first project can make instances of
the classes in the second and use those classes to access its properties and
methods.
 
S

Scott M.

You don't know how to make a reference? This is not normally done in code,
it is done from VS.NET in the reference section of the Solution Explorer. I
can tell you how to do it, but I have to say that understanding what
"solutions", "projects", "assemblies", "namespaces" and "classes" are and
how referencing one assembly allows you access to all its code is pretty
elemental to using .NET. You may want to do some research on this.

-Scott
 
G

Guest

Well, I have read the book, which does not cover this topic, and have
searchced the help menus, which if there, is well concealed. Can you do that
other thing and tell me how to do it?

Thanks.
 
S

Scott M.

I don't know what book you are referring to when you say "the book" and I
don't know where in the "help menus" you searched, but I'd say that your
book isn't worth the paper it's written on and you need some work using
help.

Here's your answer:

http://www.programmersheaven.com/2/FAQ-VISUALSTUDIO-Add-Assembly-Reference

You do know how to use Google, right? This was the second web site listed
in the results of this search"

http://www.google.com/search?q=.net...d=ie7&rls=com.microsoft:en-US&ie=utf8&oe=utf8

I'm sorry if I'm being sarcastic, but as I said, this is elemental stuff
here. I honestly suggest you pick up an entry level book on .NET or simply
look up the keywords listed earlier in the MSDN Library (which is the 2 GB's
worth of "help" provided with VS .NET or available online at:
http://msdn.microsoft.com.
 
G

Guest

The book is VB.net 03, Step by Step; by Michael Halvorson. Your right. I
have absolutely no idea of how to follow the help indices. I have however
creted three successful programs used for specialized neurological testing,
(yes, I am a neuroloigst). Now i am trying to combine them into one program.
I am also self taught thus far with programming. So I apolgize for my
ignorance of using the help indices.

When I try to add a refrence to the project as suggested, I aget an error
message that "An assembly must have a .dll extension in order to be
referenced.

Thanks for your interest and help thus far.
 
S

Scott M.

As a scientist, I'm sure you can appreciate the value of learning things in
a certain order. The error message you are getting is pretty
self-explanitory, and I can easily tell you to simply rename the compiled
project .exe's (the "assemblies") to be referenced to .dll's, rather than
..exe's, but this will then get you past one problem and sraight into
another. I could then tell you how to get by the next problem, but this
would lead to yet, another.

As I suggested earlier, understanding what "solutions", "projects",
"assemblies", "namespaces" and "classes" are and how referencing one
assembly allows you access to all its code is pretty elemental to using
..NET.

The "Step-By-Step" books have never really been good for learning (in any
detail) the topic they are descibing. They are written to show you simple
techniques to get something written and working.

I would suggest you look into learning about (in the following order):

Object-Oriented Programming Principles
The .NET Framework
VB .NET / VS .NET

There are a wide variety of books on these topics, but Google and
msdn.microsoft.com will also provide more than enough reading on this.
 
G

Guest

Well, I have spent a significant amount of time, which I don't have, reading
up on these topics to find answers, which I have not. It seems that in seven
emails, you could have been of some minimal assistance at best here, which
you have not, rather than using the communications to make sarcastic comments.
 
S

Scott M.

Wow. So the links I provided didn't:

A) Answer you question about how to reference an assembly?
B) Show you how a simple Google search can help you get to the answer you
needed?
C) Tell you where you can hear about all your questions (from the horse's
[Microsoft]) mouth?

Seems to me that I have answered your question and more.

I am simply trying to tell you that based on your questions, it seems
obvious that you need more work in understanding basic concepts in using
..NET. I have also provided suggestions for what to tackle, the order in
which you should tackle them and where you can find info. on these items.

The fact that you don't have a lot of time to do this research doesn't
really have anything to do with the fact that it needs to be done. I don't
have the time to learn neuro-science, but if I want to be able to talk with
you about it with some degree of knowledge, I have to do the work.

The fact that you say that, despite your time spent researching, you haven't
been able to find the answers you seek combined with the ease of the Google
search I provided, tells me that you haven't been searching for help
effectively.

I've tried to address that last point by giving you places to look for help
and suggestions on the types of books to use.

If you really haven't found anything useful in my message, then you should
consider giving up on learning anything more about .NET.

Good luck,

Scott
 
R

RobinS

You need to pick one of the projects to be the main one, i.e. the first
launched. Then you add a reference to that project for the other two
projects. To do that, go to the properties for the main project and click
on the References tab, click on the Add button, select the Projects tab,
and pick the other two projects. After you add them, you might want to
check the Imported Namespaces and click the checkboxes. This imports the
namespaces for you, so you don't have to reference them as
myOtherProject.MyOtherForm.

When you do that, Then you can access the forms in the other projects from
the main project, and open them or whatever it is you want to do with them.

Good luck.
Robin S.
 
G

Guest

Robin, Thanks you so much for your assistance and actually helping to answer
my questions rather than informing me where I can do research on the topic.
Unfortunately, I have tried that, and I get an error message that the file
must have a dll extenstion in order to be refereneced. I have actually done
some reading on this, however, not being a programmer by trade, I have great
difficulty.

Please advise, and thanks again.
 
R

RobinS

I understand your frustration. I read a lot of books when I was learning
..Net, and sometimes you have to read a lot to get the exact information you
need, and you don't always have the time to do that.

First, you have all three projects under the same solution, right?

How are you adding the reference? It should have tabs for selecting your
reference, something like ".Net, COM, Projects, ..." If you look under
Projects, it should show the other projects in your solution.

If you've never done a Build on those projects, you probably need to, in
order for it to reference them. And remember that you will have to Build
those before using them if you change them. (Just right-click on the
project and choose Build).

For example, I have a business layer that has a bunch of business objects
defined. To see changes to one of the business objects in my UI layer, w/o
building the entire solution, I do a build on teh business layer project,
and then I can see the changes from my UI layer.

Does that help?

BTW, you're doing VB, right?

Robin S.
--------------------------------------
 
G

Guest

Happy Easter.

Yes, I am using VB.net 2003. I did build each added project prior to adding
them. these are currently functional programs, which I now wish to combine
into one big program. But when I add the reference, I get the message that
it must be a dll not an exe. I understand this was addressed in v2005, but I
remain unclear as how to handle this in v2003.
 
S

Scott M.

Interesting, since if you go back and read what I've written, I've already
answered your .dll reference question (and I do mean answered [as in "do
this"]).

If you do your "research" like you have read my replies, it's no wonder why
you haven't found the answers you seek.
 
R

RobinS

I skipped 2003 and went straight to 2005, but I have one VB.Net 2003 book.
It looks like the references work the same way in both versions.

I don't think it matters, but what is the project type of your main
project? If you bring up the project properties and go to the Application
tab, what is the Application type?

Are you using the Projects tab under the References? It shouldn't require a
DLL. Maybe you can tell me specifically what you're doing, because it
doesn't sound like you're doing the right thing.

Robin S.
-------------------------
 
G

Guest

I basically opened a new project, and added to it three exixting projects,
which are threee programs which I now wish to package into one, with a new
single main menu to launch each program. If I am looking in the right place,
the output type under properties is a "windows application". Let me know if
this helps.
 
R

RobinS

Are all three of them Windows Applications?

Robin S.
------------------------------------
 
R

RobinS

Wait! I have a revelation! I had a problem yesterday when trying to set a
reference from a windows forms application to a class in another project in
the solution.

Instead of creating the reference to the Project, build each of the
projects singly, then add a reference in your main project, and instead of
selecting the <Projects> tab and selecting the other project, choose Browse
and then browse to the [bin] folder of the other project, and debug, and
find the dll and select it.

Does that work?

Robin S.
---------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top