Reputation: 3290
Why would VS keep saying to add this?
Sub New()
' TODO: Complete member initialization
End Sub
Upvotes: 0
Views: 66
Reputation: 11216
Since you have a constructor that takes parameters, a default, parameterless constructor is not created for you automatically.
Your LINQ statement is not calling your parameterized constructor, it need a parameterless constructor.
Basically, when you code this:
Select New CommunityEvent With {.Day = sRecord(0), etc. }
What gets generated is this
Dim obj As New CommunityEvent() 'Uses parameterless constructor
obj.Day = sRecord(0)
'etc.
When you remove the CommunityEvent With
part, then it doesn't use your class, it creates an anonymous type instead.
Upvotes: 4