I've got a compilation error. It says:
ConstructorName.ClassName is inaccessible due to its protection level
eg:
I've got a windows form with a button, when clicked it goes into code:
ClassName ABC = new ClassName();
ABC.TMsg(messagename);
Any ideas how to fix this ?
The class ClassName is located in another project in the same solution as
the windowsapplication.
Thanks
Andrew
> I've got a compilation error. It says:
> ConstructorName.ClassName is inaccessible due to its protection level
[quoted text clipped - 8 lines]
> The class ClassName is located in another project in the same solution as
> the windowsapplication.
And what's the declared access of the parameterless constructor of
ClassName?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Andrew - 06 Feb 2008 16:37 GMT
namespace ConstructorName
{ class ClassName
public void TMsg ()
{
}
}
Thanks
> > I've got a compilation error. It says:
> > ConstructorName.ClassName is inaccessible due to its protection level
[quoted text clipped - 11 lines]
> And what's the declared access of the parameterless constructor of
> ClassName?
Family Tree Mike - 06 Feb 2008 16:48 GMT
After correcting so it compiles, it seems fine to me. You are not showing a
constructor. Did you drop it in what you posted? You are missing a set of
braces around the contents of the class Classname, so it should look like:
namespace ConstructorName
{ class ClassName
{ public void TMsg ()
{
}
}
}
> namespace ConstructorName
> { class ClassName
[quoted text clipped - 21 lines]
> > And what's the declared access of the parameterless constructor of
> > ClassName?
> I've got a compilation error. It says:
> ConstructorName.ClassName is inaccessible due to its protection level
[quoted text clipped - 8 lines]
> The class ClassName is located in another project in the same
> solution as the windowsapplication.
Then one can assume that ClassName() is either private or protected.
Perhaps you are being forced to use another constructor, one with
parameters and public, instead?

Signature
Rudy Velthuis http://rvelthuis.de
"First you forget names, then you forget faces. Next you forget to
pull your zipper up and finally, you forget to pull it down."
-- George Burns.
Andrew - 06 Feb 2008 16:59 GMT
Hi guys,
I changed the class to:
public class ClassName { }
The error is gone.
cheers
Andrew
> > I've got a compilation error. It says:
> > ConstructorName.ClassName is inaccessible due to its protection level
[quoted text clipped - 12 lines]
> Perhaps you are being forced to use another constructor, one with
> parameters and public, instead?
Rudy Velthuis - 06 Feb 2008 17:10 GMT
> Hi guys,
>
> I changed the class to:
>
> public class ClassName { }
YAY!

Signature
Rudy Velthuis http://rvelthuis.de
"War is fear cloaked in courage." -- General William Westmoreland