Public Property Dataset

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
I have a dataset ds, and i want the btSave become enable everytime it changes.
VB.NET:
    Dim ds As DataSet
    Public Property dsValue() As DataSet
        Get
            Return ds
        End Get
        Set(ByVal value As DataSet)
            ds = value
            btSave.Enabled = True
        End Set
    End Property
I guess this doesnt work. When i add a table to dsvalue, it doesnt seem to goto the set.

VB.NET:
dsValue.Tables.Add(newTable)

it seem to only access the Get command when adding the table
 
That's exactly right, because you are setting the dsValue property. You're getting the dsValue property and then getting the Tables property of the DataSet that it returns. At no point are you setting that dsValue property, nor would you, as it would require you to assign a new DataSet object to the property from the outside, which would discard the existing DataSet.
 
Back
Top