473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ControlCollection constructor

K
Can anyone tell me why VB can successfully inherit from the
ControlCollection class but C# can't?

When compiling the following 2 classes, the C# version gets a compile error
of:

"No overload for method 'ControlCollection' takes '0' arguments"
// C#

public class Class1 : System.Windows.Forms.Form.ControlCollection

{

public Class1(System.Windows.Forms.Control owner)

{

}

}

' Visual Basic

Public Class Class11

Inherits System.Windows.Forms.Form.ControlCollection

Public Sub New(ByVal owner As System.Windows.Forms.Control)

End Sub

End Class
Nov 15 '05 #1
1 5613
Try this:

public class Class1 : System.Windows.Forms.Form.ControlCollection
{
public Class1(System.Windows.Forms.Form owner) : base(owner)
{
}
}

In your code, you are specifying Control parameter in constructor.
That is for Control.ControlCollection.
Can anyone tell me why VB can successfully inherit from the
ControlCollection class but C# can't?

When compiling the following 2 classes, the C# version gets a compile error
of:

"No overload for method 'ControlCollection' takes '0' arguments"
// C#

public class Class1 : System.Windows.Forms.Form.ControlCollection

{

public Class1(System.Windows.Forms.Control owner)

{

}

}

' Visual Basic

Public Class Class11

Inherits System.Windows.Forms.Form.ControlCollection

Public Sub New(ByVal owner As System.Windows.Forms.Control)

End Sub

End Class


Nov 15 '05 #2

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

Similar topics

0
by: Trevor Germain | last post by:
Scenario: --------- I have an Explorer style application. The app hosts other win forms by making them MDI children, removing border / control box / minimize / maximize, and setting the form's...
0
by: e-mid | last post by:
when i type: System.Windows.Forms.Controls. i cant see ControlCollection on the list, but i can use it. i cant see the methods on the instance either, but i can use its methods too. what...
4
by: Luboą ©lapák | last post by:
Hi, I need from ControlCollection on aspx page select all TextBoxes. How can I do it? Thanks
1
by: mccoyn | last post by:
I am having trouble adding a control to ControlCollection in a class I have derived from GroupBox. Here is what I've got __gc class RowColumn : public System::Windows::Forms::GroupBo public...
0
by: Harry F. Harrison | last post by:
Here's the situation...Context - Using an Inherited WebControl object as a base for server custom controls. In a web custom control, whenever I create a child control and add it to the Controls...
1
by: DanielSchaffer | last post by:
I am trying to create a class that inherits fromControlCollection, but I am getting the compile error "Nooverload for method 'ControlCollection' takes '0' arguments",and VS highlights the constructor...
3
by: Phill. W | last post by:
Is it possible to extend the Windows.Forms.Form.ControlCollection class and override it's Add method? I'm adding controls to a Form and want to hook up Event Handling for the Form to deal with...
3
by: Steve | last post by:
I have a number of controls within a Panel. If I do For Each ctrl In PanelMain.Controls MsgBox(ctrl.Name) Next The controls are not displayed in the sequence I would expect them to be (top...
0
by: Gursharan | last post by:
Hi, I get this error after I did a load test on my website (500 constant user load in team system for 35 minutes). This error is logged after about 1 minute of load testing and is logged every...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...

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.