Does Property return a reference to the classes object?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nate axtell

    #1

    Does Property return a reference to the classes object?

    I have a custom class with a Private DataTable member and a Public Property
    that returns this DataTable in its Get call. Is the DataTable that is
    returned from the Property's Get a reference to the class's Datatable?
    I'm binding a DataGrid in my form as follows, but adding a row with the
    bo.AddRow() method does not update what is in the DataGrid. Any
    suggestions?

    [Start Form]
    Private bo as CustomBusinessC lass
    FormLoad()
    bo = New CustomBusinessC lass()
    bo.initListing( ) '-- initializes datatable
    FormGrid.SetBin dings(bo.Listin g, "")
    End FormLoad()

    ButtonClick()
    bo.AddRow()
    End ButtonClick
    [End Form]

    Public Class CustomBusinessC lass
    Private _listing as DataTable
    Public ReadOnly Property Listing() as DataTable
    Get
    Return _listing
    End Get
    End Property

    initListing()
    ...Fill the listing by creating a DataTable manually
    end initListing

    AddRow()
    ...Add row to _listing manually
    end AddRow
    End Class


  • nate axtell

    #2
    Re: Does Property return a reference to the classes object?

    Disregard...
    My problem is with resetting the DataTable in the Business Object, not in
    the use of the Property to access the DataTable.

    "nate axtell" <naxtell at progeny dot net>[color=blue]
    >I have a custom class with a Private DataTable member and a Public Property
    >that returns this DataTable in its Get call. Is the DataTable that is
    >returned from the Property's Get a reference to the class's Datatable?
    > I'm binding a DataGrid in my form as follows, but adding a row with the
    > bo.AddRow() method does not update what is in the DataGrid. Any
    > suggestions?
    >
    > [Start Form]
    > Private bo as CustomBusinessC lass
    > FormLoad()
    > bo = New CustomBusinessC lass()
    > bo.initListing( ) '-- initializes datatable
    > FormGrid.SetBin dings(bo.Listin g, "")
    > End FormLoad()
    >
    > ButtonClick()
    > bo.AddRow()
    > End ButtonClick
    > [End Form]
    >
    > Public Class CustomBusinessC lass
    > Private _listing as DataTable
    > Public ReadOnly Property Listing() as DataTable
    > Get
    > Return _listing
    > End Get
    > End Property
    >
    > initListing()
    > ...Fill the listing by creating a DataTable manually
    > end initListing
    >
    > AddRow()
    > ...Add row to _listing manually
    > end AddRow
    > End Class
    >[/color]


    Comment

    Working...