Properties with parameters and databinding
-
Hi, I have a class that has a few properties that accepts an optional boolean parameter. For example:
Private _venues AS BSVenue Public ReadOnly Property Venues(Optional ByVal forceupdate As Boolean = False) As BSVenue() Get If _venues Is Nothing Or forceupdate Then _venues = BSVenue.GetVenuesByCourse(CourseID) End If Return _venues End Get End Property
When i try binding a member of this class to a control it says it cannot find the property. It works fine if the property has no parameters. Whats going on? -
Hi, I have a class that has a few properties that accepts an optional boolean parameter. For example:
Private _venues AS BSVenue Public ReadOnly Property Venues(Optional ByVal forceupdate As Boolean = False) As BSVenue() Get If _venues Is Nothing Or forceupdate Then _venues = BSVenue.GetVenuesByCourse(CourseID) End If Return _venues End Get End Property
When i try binding a member of this class to a control it says it cannot find the property. It works fine if the property has no parameters. Whats going on?Have you tried defining the Property twice? One without a parameter and one with e.g.
Public ReadOnly Property Venues() As BSVenue()
Get
Return Venues(False)
End Get
End PropertyPublic ReadOnly Property Venues(ByVal forceupdate As Boolean) As BSVenue()
Get
If _venues Is Nothing Or forceupdate Then
_venues = BSVenue.GetVenuesByCourse(CourseID)
End If
Return _venues
End Get
End PropertySteve Jowett ------------------------- It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
-
Have you tried defining the Property twice? One without a parameter and one with e.g.
Public ReadOnly Property Venues() As BSVenue()
Get
Return Venues(False)
End Get
End PropertyPublic ReadOnly Property Venues(ByVal forceupdate As Boolean) As BSVenue()
Get
If _venues Is Nothing Or forceupdate Then
_venues = BSVenue.GetVenuesByCourse(CourseID)
End If
Return _venues
End Get
End PropertySteve Jowett ------------------------- It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
I got the same answer off a guy i work with. I think thats the way to do it. I dont get why the databinding process doesnt just ignore the optional parameter. Thanks for your response!