Use other class member function in same namespace

C

Chi Tang

Hi,

I have 2 questions:

How to call a class member function from another class and these 2 classes
are in the same namespace?

Also, how to use another project's dialog box and this 2 projects are in the
same VS.NET solution?

Thanks for any help,

CT
 
I

Ignacio Machin

Hi Chi,

1: How to call a class member function from another class and these 2
classes are in the same namespace?

You can call a class's member if this member is declared as public static,
if they are in the same namespace, then you do not have to include a "using"
directive or fully quilify it. If the method is declared only as "public"
then it's a method instance and you will need to call it using an instance
of that class.

2: Also, how to use another project's dialog box and this 2 projects are in
the same VS.NET solution?

Well that depend, the second project must be of type Class Library to be
included in the first project, if the sboth projects are of type "Windows
Project" , then AFAIK there is not way of doing so, at least directly in the
IDE, you could use reflection to load the assembly and instantiate the class
at runtime, but again, I do not know for sure that this is possible, I will
search for it.
Please provide more info regarding the projects types.

Hope this help,
 
C

Chi Tang

Thanks for the reply. For the 2nd question boht projects are windows
application so I think I should put some common function into a class
library and used by both projects. I just try to use some dialog box
resource (or forms) in both projects. Anyway, really appreciate all
help...

CT
 

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