# SavePanelState

int SavePanelState (int panelHandle, char filename[], int stateIndex);

## Purpose

Saves the current values of all controls on a panel.

This function also saves the following control attributes:

- Label/value pairs of the list-type controls, and their indices
- Minimum, maximum, and increment values for numerics
- List box checkmark state values

If you want to retain the data for plots in a graph control, your original array must still be in memory when you call RecallPanelState. Alternatively, you can configure the graph to make a copy of your plot data. You can do this in the User Interface Editor or by calling SetCtrlAttribute with the ATTR_COPY_ORIGINAL_DATA attribute.

## Parameters

Input
Name | Type | Description
panelHandle | integer | Specifier for a particular panel that is currently in memory. You obtain this handle from LoadPanel, NewPanel, or DuplicatePanel.
filename | string | Name of the file in which to save the panel state. If the name is a simple filename that contains no directory path, the file is saved in the directory that contains the executable.
stateIndex | integer | Assigns a unique state index to each panel state so that you can save multiple panel states to the same file. When you recall a particular panel state using RecallPanelState, use the same State Index assigned using SavePanelState. If the file already contains a panel with the same state index, SavePanelState overwrites it.

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.
Code | Error Message String
xx | Success