Click here to Skip to main content
15,915,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Regards,
Every time I try to run my application, the following error:
"Too many arguments to 'Public Sub New()"

Now,the error occurs in the following method:

VB
Public Sub AddDataTotale(ByVal AllDonnees As String) 
        Dim DatosTotal = New DataAudit(AllDonnees)
        Me.DonneeTotale.Add(DatosTotal)
    End Sub

The error is located precisely in "ALLDonnees".I want to point out that this method is in the class DataGeneral.
Now, Visual studio gives me the option to create the Constructor in another class called DataAudit:
VB
Private _allDonnees As String

    Sub New(ByVal AllDonnees As String)
        'TODO: Complete member initialization 
                _allDonnees = AllDonnees
    End Sub

When I create the constructor, the error disappears.
Who can explain the cause of the error. There is another way to solve this problem?
thank you very much
Posted

The default constructor has no arguments. You are doing something that requires a default constructor. Therefore I would create a default constructor and put a breakpoint in it. If you try to use serialization you can get this error.
 
Share this answer
 
Hi
Did u write a Sub new for DataAudit Class?

The error means you've provided to many or too few parameters for the New DataAudit
 
Share this answer
 
v2
Comments
alonetmr 29-Jul-13 7:46am    
Hi,
Yes, I wrote a Sub new in DataAudit Class.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900