ComponentOne Olap for WinForms
C1.Win.Olap.4 Assembly / C1.Win.Olap Namespace / C1OlapPanel Class / ViewDefinition Property
Example

In This Topic
    ViewDefinition Property (C1OlapPanel)
    In This Topic
    Gets or sets an XML string containing an Olap view definition.
    Syntax
    'Declaration
     
    Public Property ViewDefinition As System.String
    public System.string ViewDefinition {get; set;}
    Remarks

    This property is typically used to persist the current view as an application setting, so views are preserved across sessions.

    Example
    The code below loads an Olap view from the application settings when the application starts, and saves them back when the application ends.
    public Form1()
    {
      InitializeComponent();
      
      // assign data to Olap panel
      _c1OlapPanel.DataSource = GetDataTable();
      
      // load/create default view
      try
      {
        _c1OlapPanel.ViewDefinition = Properties.Settings.Default.OlapView;
      }
      catch { }
    }
                
    // save this view as the default
    void _btnSaveAsDefault_Click(object sender, EventArgs e)
    {
      try
      {
        Properties.Settings.Default.OlapView = _c1OlapPanel.ViewDefinition;
        Properties.Settings.Default.Save();
      }
      catch (Exception x)
      {
        MessageBox.Show(x.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
      }
    }
    See Also