473,789 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about namespaces and classes...

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.L ogicalGroup.MyN ewClassName.thi sstaticfunction () 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.
Nov 15 '05 #1
5 1297
Joe,

Done that. Comment out the
MyCompanyName.L ogicalGroup.MyN ewClassName.thi sstaticfunc() and it compile
fine.
Remove the // and compile and viola, same error as before.... *sigh*
Erin.

"Joe Mayo" <jm***@ddiieess ppaammeerrssddi iee.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
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

"EMonaco" <er********@nos pam.net> wrote in message
news:ON******** *****@TK2MSFTNG P12.phx.gbl...
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.L ogicalGroup.MyN ewClassName.thi sstaticfunction () 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.


Nov 15 '05 #2
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

"EMonaco" <er********@nos pam.net> wrote in message
news:uP******** ******@TK2MSFTN GP10.phx.gbl...
Joe,

Done that. Comment out the
MyCompanyName.L ogicalGroup.MyN ewClassName.thi sstaticfunc() and it compile
fine.
Remove the // and compile and viola, same error as before.... *sigh*
Erin.

"Joe Mayo" <jm***@ddiieess ppaammeerrssddi iee.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
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

"EMonaco" <er********@nos pam.net> wrote in message
news:ON******** *****@TK2MSFTNG P12.phx.gbl...
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.L ogicalGroup.MyN ewClassName.thi sstaticfunction () 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.



Nov 15 '05 #3

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" <er********@nos pam.net>
| References: <ON************ *@TK2MSFTNGP12. phx.gbl>
<#F************ **@TK2MSFTNGP10 .phx.gbl>
| 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: <uP************ **@TK2MSFTNGP10 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: bgp01114046bgs. westln01.mi.com cast.net 68.42.93.214
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1796 88
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
|
| Joe,
|
| Done that. Comment out the
| MyCompanyName.L ogicalGroup.MyN ewClassName.thi sstaticfunc() and it compile
| fine.
| Remove the // and compile and viola, same error as before.... *sigh*
|
|
| Erin.
|
| "Joe Mayo" <jm***@ddiieess ppaammeerrssddi iee.com> wrote in message
| news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
| > 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
| >
| > "EMonaco" <er********@nos pam.net> wrote in message
| > news:ON******** *****@TK2MSFTNG P12.phx.gbl...
| > > 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.L ogicalGroup.MyN ewClassName.thi sstaticfunction () 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.
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #4
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 DataBasementSof tware.... recompile- still
nothing.
So I deleted the line, ctrl-space will not bring the popup when i have an
incomplete line such as this.rtbTextToP ass =
I deleted the line again. Start with ctrl-space, go through the popup
namespaces MyCompanyName.L ogicalGroup.MyN ewClassName.thi sstaticfunction (
then put in the args that displayed, terminated it with ): and then went to
the start and added the this.rtbTextToP ass = 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.
"Joe Mayo" <jm***@ddiieess ppaammeerrssddi iee.com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
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

"EMonaco" <er********@nos pam.net> wrote in message
news:uP******** ******@TK2MSFTN GP10.phx.gbl...
Joe,

Done that. Comment out the
MyCompanyName.L ogicalGroup.MyN ewClassName.thi sstaticfunc() and it compile
fine.
Remove the // and compile and viola, same error as before.... *sigh*
Erin.

"Joe Mayo" <jm***@ddiieess ppaammeerrssddi iee.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
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

"EMonaco" <er********@nos pam.net> wrote in message
news:ON******** *****@TK2MSFTNG P12.phx.gbl...
> 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.L ogicalGroup.MyN ewClassName.thi sstaticfunction () 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.
>
>



Nov 15 '05 #5

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" <er********@nos pam.net>
| References: <ON************ *@TK2MSFTNGP12. phx.gbl>
<#F************ **@TK2MSFTNGP10 .phx.gbl>
<uP************ **@TK2MSFTNGP10 .phx.gbl>
<#L************ **@tk2msftngp13 .phx.gbl>
| 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: <uK************ **@TK2MSFTNGP12 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| NNTP-Posting-Host: bgp01114046bgs. westln01.mi.com cast.net 68.42.93.214
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP12.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1797 05
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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 DataBasementSof tware.... recompile- still
| nothing.
|
|
| So I deleted the line, ctrl-space will not bring the popup when i have
an
| incomplete line such as this.rtbTextToP ass =
| I deleted the line again. Start with ctrl-space, go through the popup
| namespaces MyCompanyName.L ogicalGroup.MyN ewClassName.thi sstaticfunction (
| then put in the args that displayed, terminated it with ): and then went
to
| the start and added the this.rtbTextToP ass = 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.
|
|
| "Joe Mayo" <jm***@ddiieess ppaammeerrssddi iee.com> wrote in message
| news:%2******** ********@tk2msf tngp13.phx.gbl. ..
| > 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
| >
| > "EMonaco" <er********@nos pam.net> wrote in message
| > news:uP******** ******@TK2MSFTN GP10.phx.gbl...
| > > Joe,
| > >
| > > Done that. Comment out the
| > > MyCompanyName.L ogicalGroup.MyN ewClassName.thi sstaticfunc() and it
| compile
| > > fine.
| > > Remove the // and compile and viola, same error as before.... *sigh*
| > >
| > >
| > > Erin.
| > >
| > > "Joe Mayo" <jm***@ddiieess ppaammeerrssddi iee.com> wrote in message
| > > news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
| > > > 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
| > > >
| > > > "EMonaco" <er********@nos pam.net> wrote in message
| > > > news:ON******** *****@TK2MSFTNG P12.phx.gbl...
| > > > > 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.L ogicalGroup.MyN ewClassName.thi sstaticfunction ()
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.
| > > > >
| > > > >
| > > >
| > > >
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1793
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I understand that you declare your intention to use a namespace within a page through the "Inherits" attribute. I know that using "Inherits" isn't absolutely necessary, it's just recommended so the developer doesn't have to type out the entire...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.