FlexSheet for WPF | ComponentOne
Quick Start: FlexSheet for WPF / Step 2 of 3: Adding a Sheet and Populating it with Data
In This Topic
    Step 2 of 3: Adding a Sheet and Populating it with Data
    In This Topic

    In the last step, you created a WPF application and added the C1FlexSheet control to it. In this step, you add a sheet to the control and populate it with ordered data to see how the control works.

    1. Add a new sheet to FlexSheet control by adding the following code beneath InitializeComponent() method in the interaction logic for XAML:

      flex.AddSheet("Sheet1", 50, 10)
      
      flex.AddSheet("Sheet1", 50, 10);
      
    2. Populate the sheet with data by adding the following code:

      ' populate the grid with some formulas (multiplication table)
      For r As Integer = 0 To flex.Rows.Count - 3
          Dim datas As New List(Of Double)()
          For c As Integer = 0 To flex.Columns.Count - 1
              flex(r, c) = String.Format("={0}*{1}", r + 1, c + 1)
              Dim value As Double = CDbl(flex(r, c))
              datas.Add(value)
          Next
      
      // populate the grid with some formulas (multiplication table)
      for (int r = 0; r < flex.Rows.Count - 2; r++)
      {
          List<double> datas = new List<double>();
          for (int c = 0; c < flex.Columns.Count; c++)
          {
              flex[r, c] = string.Format("={0}*{1}", r + 1, c + 1);
              double value = (double)flex[r, c];
              datas.Add(value);
          }
      }
      

    With this, you have successfully added a sheet to your FlexSheet control and populated it with data.