Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overload resolution failed because no "New" is accessible

Status
Not open for further replies.

BSM24

Programmer
Nov 16, 2011
1
US
Code:
     Dim expression1 As Expression
            Dim expression2 As Expression
            Dim expression3 As Expression
            Dim expression4 As Expression
            Dim expression5 As Expression
            Dim expression6 As Expression
            Dim expCol As New ExpressionCollection
            Dim export As ExpressionCollection.ExportMode
            Dim sort As ExpressionCollection.SortType
            Dim import As ExpressionCollection.ImportMode
            Dim expModified As Boolean
            Dim errorMessages As String()


            expCol.ImportFromFile("list_file", import.Replace, expModified, errorMessages)

The Line "Dim expCol As New ExpressionCollection" is giving me the compilation error. Is there an alternate way to instantiate an object?

I attached the full source code, if you need more context.

Any help is appreciated.
 

I am not familiar with the ExpressionCollection class. It appears from the message as if there is not a constructor that takes zero arguments?

You have to find an available constructor and pass the correct # of arguments.
Dim expCol as ExpressionCollection
expCol = new ExpressionCollection(argument1,argument2,...)

If there is a zero parameter constructor then I am not sure of the issue.
 

I have no idea what ExpressionCollection is, but the error you are getting means that the class does not have a New method (constructor), so you would declare it like this:

Dim expCol As ExpressionCollection

without the New keyword.

Look through the documentation to see if some other object returns an ExpressionCollection from one of its methods. That will be how you get an ExpressionCollection object.

expCol = SomeObject.SomeMethodThatReturnsAnExpressionCollection()



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
My mistake. If there was a constructor but with different number of arguments the error message would say something more like.
"Overload resolution failed because no "New" accepts this number of type arguments"
In this case no constructor exists.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top