GrapeCity.Xaml.SpreadSheet.Data
SetDataSource Method
Example 


GrapeCity.Xaml.SpreadSheet.Data Namespace > Worksheet Class : SetDataSource Method
the data source that populates the sheet
bool value that indicates whether to reset settings on the sheet
Sets the data source that populates the sheet.
Syntax
'Declaration
 
Public Sub SetDataSource( _
   ByVal dataSource As Object, _
   ByVal reset As Boolean _
) 
'Usage
 
Dim instance As Worksheet
Dim dataSource As Object
Dim reset As Boolean
 
instance.SetDataSource(dataSource, reset)
public void SetDataSource( 
   object dataSource,
   bool reset
)

Parameters

dataSource
the data source that populates the sheet
reset
bool value that indicates whether to reset settings on the sheet
Example
This example uses the SetDataSource method.
public class lname
        {
            public string last { get; set; }
            public int val { get; set; }
            public lname(string last, int val)
            {
                this.last = last;
                this.val = val;
            }
        }

        private void Grid_Loaded_1(object sender, RoutedEventArgs e)
        {
            lname[] arr = new lname[] { new lname("Smith", 100), new lname("Fender", 3), new lname("Gill", 5) };
            gcSpreadSheet1.Sheets[0].SetDataSource(arr, false);
            gcSpreadSheet1.Invalidate();
         }
Public Class lname
        Public Property last() As String
            Get
                Return m_last
            End Get
            Set(value As String)
                m_last = Value
            End Set
        End Property
        Private m_last As String
        Public Property val() As Integer
            Get
                Return m_val
            End Get
            Set(value As Integer)
                m_val = Value
            End Set
        End Property
        Private m_val As Integer
        Public Sub New(last As String, val As Integer)
            Me.last = last
            Me.val = val
        End Sub
    End Class


 Private Sub Grid_Loaded_1(sender As Object, e As RoutedEventArgs)
        Dim arr As lname() = New lname() {New lname("Smith", 100), New lname("Fender", 3), New lname("Gill", 5)}
        GcSpreadSheet1.Sheets(0).SetDataSource(arr, False)
    End Sub
See Also

Reference

Worksheet Class
Worksheet Members