Question Getting An Error - Don't Know Why

TylerMorrison

Member
Joined
Aug 19, 2011
Messages
7
Programming Experience
Beginner
Hi Guys, I'm new to these forums so I'm not 100% sure if this is where this should go but oh well :D

I'm currently developing a Vb.net application in VB Express. I recently just broke out my class files into a separate project in the same solution as my forms. My error is that whenever I call one of my classes I get an Overload Resolution failed because no accessible 'New' accepts this number of arguments

Projects:
BusinessObjects - Has all of my class files
Spectrum - Has all of the forms

Sample Of Code

Form Call To Business Objects
VB.NET:
Imports BusinessObjects

Public Class frmBT
 'On Form Load
    Private Sub frmBT_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim tenders As New clsHotListTender(myConnString)
   End Sub
End Class

clsHotListTender

VB.NET:
Public Class clsHotListTender

Public Sub New(connString as string)
'Initalize class
End Sub

End Class

So I'm confused because I Import BusinessObjects so the form should know what clsHotListTender is, and there is a New constructor which takes in one variable so it shouldn't be getting the error.

With that said if I put BusinessObjects.clsHotListTender(myConnString) instead of clsHotListTender(myConnString) I don't get the error. :S
 
It would seem there still is a clsHotListTender class in Spectrum project.
 
It doesn't show it as a file under the project in VB Express. It used to be in there but I removed it, maybe I didn't remove it all the way and the project still thinks it's there, but if that's the case I don't know how to get the project to realize it's gone.
 
If there is doubt about the definition you can right-click the type (or method) and select 'Go To Definition', it should show what compiler sees.

Also, do you have a solution with those two projects in? Is the reference an assembly reference or a project reference?
 
Try to 'Clean Solution' (Build menu/toolbar usually) - or exit VS and delete the bin/obj folders. Next build everything including the VS build cache is rebuilt.
 
Back
Top