Question about namespaces and classes...

E

EMonaco

All,

I have a simple C# window app under MyApp namespace it has a class Form1.
I've added another class .cs file.
Now this class I want to share with many projects, so I figured I'd change
this class.cs file from

namespace MyApp
Class MyClass

to:
namespace MyCompanyName
namespace LogicalGroup
class MyNewClassName

In the form class I try
MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunction() and it
complains that MyCompanyName namespace could not be found? I tried a using
MyCompanyName and the namespaces I just created do not show up in
intellisense</> popups.

Obviously I need to do this a bit differently to get it to work, but I don't
want a separate assembly, dll or exe that will need to be installed or
copied in order to do this. What am I missing or is there a different route
I need to take?


Regards,
Erin.
 
E

EMonaco

Joe,

Done that. Comment out the
MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunc() and it compile
fine.
Remove the // and compile and viola, same error as before.... *sigh*


Erin.
 
J

Joe Mayo

Is the class in a separate assembly? If so, did you accidently lose your
reference? I suppose if you press Ctrl-Space MyCompanyName doesn't appear
in the list.

Joe
 
J

Jeffrey Tan[MSFT]

Hi EMonaco,

Have you compiled before using your customer class?
In my sample project, it just works well.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "EMonaco" <[email protected]>
| References: <[email protected]>
<#[email protected]>
| Subject: Re: Question about namespaces and classes...
| Date: Tue, 26 Aug 2003 20:33:51 -0400
| Lines: 63
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: bgp01114046bgs.westln01.mi.comcast.net 68.42.93.214
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:179688
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Joe,
|
| Done that. Comment out the
| MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunc() and it compile
| fine.
| Remove the // and compile and viola, same error as before.... *sigh*
|
|
| Erin.
|
| | > What you're trying to do looks okay to me. I've had this type of
problem
| > when there was some other type of error in the file, which causes
| > intellisense not to show on the line I'm working with. Maybe you could
| > remove the reference, get a good compile, and try again.
| >
| > Joe
| > --
| > http://www.csharp-station.com
| >
| > | > > All,
| > >
| > > I have a simple C# window app under MyApp namespace it has a class
| > Form1.
| > > I've added another class .cs file.
| > > Now this class I want to share with many projects, so I figured I'd
| change
| > > this class.cs file from
| > >
| > > namespace MyApp
| > > Class MyClass
| > >
| > > to:
| > > namespace MyCompanyName
| > > namespace LogicalGroup
| > > class MyNewClassName
| > >
| > > In the form class I try
| > > MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunction() and
it
| > > complains that MyCompanyName namespace could not be found? I tried a
| using
| > > MyCompanyName and the namespaces I just created do not show up in
| > > intellisense</> popups.
| > >
| > > Obviously I need to do this a bit differently to get it to work, but I
| > don't
| > > want a separate assembly, dll or exe that will need to be installed or
| > > copied in order to do this. What am I missing or is there a different
| > route
| > > I need to take?
| > >
| > >
| > > Regards,
| > > Erin.
| > >
| > >
| >
| >
|
|
|
 
E

EMonaco

Joe,

The class is a seperate .cs file included as part of the project.
If I switch to the Class View pane I can see both (top level) namespaces,
and all the class, members, etc below them!
If I do ctrl-space I *do* see DataBasementSoftware.... recompile- still
nothing.


So I deleted the line, ctrl-space will not bring the popup when i have an
incomplete line such as this.rtbTextToPass =
I deleted the line again. Start with ctrl-space, go through the popup
namespaces MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunction(
then put in the args that displayed, terminated it with ): and then went to
the start and added the this.rtbTextToPass = in front of it... recompiled
and what do you know... it worked!

Went back to the original- checked case and spelling and its identical, so I
don't know what gives with that!?
Thanks for the help though. Have to remember that ctrl-space trick. As a
side note- I wish intellisense would always work- I've noticed if you have
errors- (ie; forget the ; terminator have mismatched ()'s etc, that it will
no longer show).

Erin.
 
J

Jeffrey Tan[MSFT]

Hi Joe,

I am glad it worked finally.
I recommand you do the same thing in a new project to find if the problem
still arise.
If it still arise, please feel free to tell me

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "EMonaco" <[email protected]>
| References: <[email protected]>
<#[email protected]>
<[email protected]>
<#[email protected]>
| Subject: Re: Question about namespaces and classes...
| Date: Tue, 26 Aug 2003 22:03:02 -0400
| Lines: 113
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <uKd#p#[email protected]>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: bgp01114046bgs.westln01.mi.comcast.net 68.42.93.214
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:179705
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Joe,
|
| The class is a seperate .cs file included as part of the project.
| If I switch to the Class View pane I can see both (top level)
namespaces,
| and all the class, members, etc below them!
| If I do ctrl-space I *do* see DataBasementSoftware.... recompile- still
| nothing.
|
|
| So I deleted the line, ctrl-space will not bring the popup when i have
an
| incomplete line such as this.rtbTextToPass =
| I deleted the line again. Start with ctrl-space, go through the popup
| namespaces MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunction(
| then put in the args that displayed, terminated it with ): and then went
to
| the start and added the this.rtbTextToPass = in front of it... recompiled
| and what do you know... it worked!
|
| Went back to the original- checked case and spelling and its identical,
so I
| don't know what gives with that!?
| Thanks for the help though. Have to remember that ctrl-space trick. As a
| side note- I wish intellisense would always work- I've noticed if you have
| errors- (ie; forget the ; terminator have mismatched ()'s etc, that it
will
| no longer show).
|
| Erin.
|
|
| | > Is the class in a separate assembly? If so, did you accidently lose
your
| > reference? I suppose if you press Ctrl-Space MyCompanyName doesn't
appear
| > in the list.
| >
| > Joe
| > --
| > http://www.csharp-station.com
| >
| > | > > Joe,
| > >
| > > Done that. Comment out the
| > > MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunc() and it
| compile
| > > fine.
| > > Remove the // and compile and viola, same error as before.... *sigh*
| > >
| > >
| > > Erin.
| > >
| > > | > > > What you're trying to do looks okay to me. I've had this type of
| > problem
| > > > when there was some other type of error in the file, which causes
| > > > intellisense not to show on the line I'm working with. Maybe you
| could
| > > > remove the reference, get a good compile, and try again.
| > > >
| > > > Joe
| > > > --
| > > > http://www.csharp-station.com
| > > >
| > > > | > > > > All,
| > > > >
| > > > > I have a simple C# window app under MyApp namespace it has a
class
| > > > Form1.
| > > > > I've added another class .cs file.
| > > > > Now this class I want to share with many projects, so I figured
I'd
| > > change
| > > > > this class.cs file from
| > > > >
| > > > > namespace MyApp
| > > > > Class MyClass
| > > > >
| > > > > to:
| > > > > namespace MyCompanyName
| > > > > namespace LogicalGroup
| > > > > class MyNewClassName
| > > > >
| > > > > In the form class I try
| > > > > MyCompanyName.LogicalGroup.MyNewClassName.thisstaticfunction()
and
| > it
| > > > > complains that MyCompanyName namespace could not be found? I
tried a
| > > using
| > > > > MyCompanyName and the namespaces I just created do not show up in
| > > > > intellisense</> popups.
| > > > >
| > > > > Obviously I need to do this a bit differently to get it to work,
but
| I
| > > > don't
| > > > > want a separate assembly, dll or exe that will need to be
installed
| or
| > > > > copied in order to do this. What am I missing or is there a
| different
| > > > route
| > > > > I need to take?
| > > > >
| > > > >
| > > > > Regards,
| > > > > Erin.
| > > > >
| > > > >
| > > >
| > > >
| > >
| > >
| >
| >
|
|
|
 

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