# Loading and Saving to a String

## Content



In addition to loading and saving to an XML file, the chart has the ability to save to a string value. This string can then be saved in an application and retrieved at a future time.

C1Chart provides four methods for loading and saving chart to a string: [SaveChartToString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.SaveChartToString.html), [LoadChartFromString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.LoadChartFromString.html), [SaveChartAndImagesToString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.SaveChartAndImagesToString.html), and [LoadChartAndImagesFromString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.LoadChartAndImagesFromString.html).

The [SaveChartToString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.SaveChartToString.html) and [LoadChartFromString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.LoadChartFromString.html) methods enable you to save a copy of the chart to a string value in the application. This string value contains all the set properties, methods, and events for the chart, in essence, its formatting. The chart can save to this file, and then if the structure remains intact, load a chart from this file.

The [SaveChartAndImagesToString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.SaveChartAndImagesToString.html) and [LoadChartAndImagesFromString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.LoadChartAndImagesFromString.html) methods does the same as the [SaveChartToString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.SaveChartToString.html) and [LoadChartFromString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.LoadChartFromString.html) methods except that they capture the various background images of the chart elements (chart, header, footer, labels).To save the chart to a string at run time, call the [SaveChartToString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.SaveChartToString.html) method, this takes no parameters and returns the string value:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
Dim ChartString As String
ChartString = C1Chart1.SaveChartToString()
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
string  ChartString;
ChartString = c1Chart1.SaveChartToString();
```

DOC-DETAILS-TAG-CLOSE

To load the chart from a string value at run time, call the [LoadChartFromString](/componentone/api/win/online-chart2d/dotnet-framework-api/C1.Win.C1Chart.4.8/C1.Win.C1Chart.C1Chart.LoadChartFromString.html) method, which takes the saved chart string as its only parameter:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
C1Chart1.LoadChartFromString(ChartString)
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
c1Chart1.LoadChartFromString(ChartString);
```

DOC-DETAILS-TAG-CLOSE

## See Also

[Loading and Saving Chart to a File](/componentone/docs/win/online-chart2d/loadingandsavingchar/loadingandsavingchar1)