Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Properties with parameters and databinding

Properties with parameters and databinding

Scheduled Pinned Locked Moved Visual Basic
wpfwcftutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Brydon
    wrote on last edited by
    #1

    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?

    S 1 Reply Last reply
    0
    • K Kevin Brydon

      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?

      S Offline
      S Offline
      Steven J Jowett
      wrote on last edited by
      #2

      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 Property

      Public 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 Property

      Steve Jowett ------------------------- It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)

      K 1 Reply Last reply
      0
      • S Steven J Jowett

        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 Property

        Public 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 Property

        Steve Jowett ------------------------- It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)

        K Offline
        K Offline
        Kevin Brydon
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups