|
The default accessibility is always private. This applies to classes, methods, properties, and fields.
In your code sample, defining MainConsole with out specifying the accessibility makes it private. However, the problem you are running into isn't the accessibility on the class since in this case, they are both private.
In MainConsole you do not have a default constructor, so the compiler is generating one for you. The compiler generated constructor is always private. When you then try to derive MyClass from it, MyClass has a public constructor. What the compiler sees is that you have a class with a public constructor inheriting from one with a private constructor and says that there is no way for the derived class to create an instance of the base class. (If something is private, even the derived classes don't have visibility to it.)
[modification 13:28 Tuesday 4th September, 2007]
I was wrong on this response, not sure what I was thinking. See this response: http://www.codeproject.com/script/comments/forums.asp?forumid=1649&select=2209501&mpp=50&fr=354&df=100#xx2209501xx[^]
[/modification]
|
|
|
|
|
|
Hmmm, default accessibility for classes and structs is internal, nested classes and structs are private. If you create no constructors for a class it will have a default public constructor.
The error he gets is because MainConsole is internal and he creates a public class that inherits from it.
|
|
|
|
|
You're right...I'm not sure what I was thinking when I wrote that response.
|
|
|
|
|
Default accessibility is private for everything but namespace elements.
That means classes, structs, delegates or enums that are not defined within another class are by default internal. In all other cases accessibility defaults to private.
In your case, the myClass and MainConsole classes are internal.
|
|
|
|
|
|
how van i change default printer page size to A6? i got printer name from installedprinters and i want to change page size of it to A6
thank you
|
|
|
|
|
|
is there any managed code for it?
|
|
|
|
|
|
Hi everyone,
Im trying to create a Container Control, which has selfdrawn borders and a few buttons to do something with it. I would like that my Control behaves professional, like a Windows.Forms.Control.
But now comes my Problem:
All I want to achieve is that no SubControl which I add to my Control can overlay the Control's borders.
I've tried to redirect the ControlCollection with my own inherited ControlCollection to an inner Panel wich then would have exact the ClientSize i want. - That works fine as long as you are not working with the Visual-Studio Designer else it throws NullReferenceExceptions or IndexOutOfRangeExceptions(Because the Control's Collection doesnt contain the inner Panel).
So now my next thought was to manipulate the ClientSize. A Form has a smaller ClientSize according to its Size then a Control because of its Border. So what if someone like me, wants his Control to have a different Border then the usual "FixedSingle,Fixed3d and None" then he must have to manipulate the CLientSize according to his Control's Border.
Ok unfortunatly Im not able to achieve this because when I resize the CLientSize also the Size Property changes and vise versa.
Hope someone has an idea how I could break this behavior.
Thanks in advance and sorry for my spelling mistakes.
XXX
|
|
|
|
|
I can't insert breakpoints with F9 anymore in Visual Studio. Any tip what can be wrong? (I can use F5 to rum my program so it is not the F-lock button that is dissabled)
_____________________________
...and justice for all
APe
|
|
|
|
|
|
Hello everyone,
I am using Visual Studio 2005 to develop a C# COM Class Library project. There is a setting in Build --> Output, called *Register for COM Interop*. What is the usage of this setting? In my situation, do I need to set this option?
thanks in advance,
George
|
|
|
|
|
Indicates that your managed application will expose a COM object (a COM callable wrapper) that allows a COM object to interact with your managed application. The Output type property in the Application page of the Project Designer for this application must be set to Class Library in order for the Register for COM interop property to be available. For an example class that you might include in your Visual C# application and expose as a COM object, see Example COM Class (C# Programming Guide).
using System.Runtime.InteropServices;
namespace project_name
{
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComClass1Interface
{
}
[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComClass1Events
{
}
[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ComClass1Events))]
public class ComClass1 : ComClass1Interface
{
}
|
|
|
|
|
Thanks Yanshof,
I am wondering what detailed operations is Visual Studio 2005 doing if this option is selected in your sample.
I am wondering what is the differences between using this Visual Studio 2005 option and do the following work by myself,
1. regasm /codebase <assembly name="">;
2. regasm /tlb <assembly name="">.
regards,
George
|
|
|
|
|
George_George wrote: Register for COM Interop
It would, I guess, automatically create necessary type libraries and called regsvr32 also for you.
|
|
|
|
|
Hi Vasudevan,
For C# managed COM, it should be mscoree.dll other than regsvr32 which is acting as the host for all COM components, right?
regards,
George
|
|
|
|
|
Hello
This is the code of save data in the SQLDataBase:
con.Open();
str3 = "INSERT INTO [CreditCard].[dbo].[CreditCardInfo] ([CreditTypeID],[CreditcardNumber],[Name],[BankID],[ExpiryDate],[EntryDate],[MachineTypeID]) VALUES((" & crId & "),(" & crNum & "),('" & Name & "'),(" & bnkId & "),('" & dtm & "'),('" & now & "'),(" & mId & "))";
cmd = new SqlCommand(str3, con);
adap.SelectCommand = cmd;
Thanks in advance
Assaf
|
|
|
|
|
hi Assaf :
what is the problem in this code?
Rami Abdalhalim
|
|
|
|
|
the problem is this line of the insert statment is always blue
the tool tip that appearis:
"operator '&' cannot be applied to operands of type 'string'and 'int'"
i don't what the problem and this not usually that i have this problem.
Thanks in advance
Assaf
|
|
|
|
|
A neater stored procedure would have been more easier to debug. Can you see the formed SQL statement in Quick Watch window in the Query Analyser? That should be easier to identify and isolate the malady.
|
|
|
|
|
The problem is not in the SQL statement. He's using the & operator from VB in C# code...
---
single minded; short sighted; long gone;
|
|
|
|
|
Yep. Alongside with that, the vulnerability might play havoc for him in the long run. Wouldn't it?
|
|
|
|
|
Yes, it definitely will.
But not as long as he can't even compiler the code.
---
single minded; short sighted; long gone;
|
|
|
|