Hi All
I am trying to create a custom class to hold data from a database with the following code
Public Class NewsObject
Public Property articleID() As Integer
Public Property articleTitle() As String
Public Property articleBody() As String
Public Sub New()
End Sub
Public Sub New(ByVal articleid As Integer, ByVal atricletitle As String)
Me.articleID = articleid
Me.articleTitle = atricletitle
End Sub
Public Sub New(ByVal atricletitle As String, ByVal articlebody As String)
Me.articleTitle = atricletitle
Me.articleBody = articlebody
End Sub
Public Sub New(ByVal articleid As Integer, ByVal atricletitle As String, ByVal articlebody As String)
Me.articleID = articleid
Me.articleTitle = atricletitle
Me.articleBody = articlebody
End Sub
End Class
When I try to create an instance of this object I cannot use the 2nd or 3rd constructor
throws an overload resolution exception. I know both constructors have the same number of parameters
but they are of different data types so I thought this was allowed
It probably is coming from the data types you are using to call things -- ie if you are passing in the result of a textbox that might look like an integer but it actually is a string insofar as the CLR goes. Anyhow, try explicit casts to see if that helps.
Bookmarks