| Task-Based Help > Creating Custom FlexPivot Application in Code > Persisting Views |
Users can also persist the view they created in their FlexPivot application across session. Any customization made by the user on the view can be saved and restored when the application is run next time.
To persist views, perform the following steps.
Protected Overrides Sub OnClosing(e As CancelEventArgs) 'save current view as new default My.Settings.DefaultView = c1FlexPivotPage1.ViewDefinition My.MySettings.Default.Save() MyBase.OnClosing(e) End Sub
// saves current view as default for next time when the form closes protected override void OnClosing(CancelEventArgs e) { // save current view as new default Properties.Settings.Default.DefaultView = c1FlexPivotPage1.ViewDefinition; Properties.Settings.Default.Save(); base.OnClosing(e); }
Close the application and restart it by pressing F5. The last view that you created persists and appears as the default view.