| GanttView for WinForms Task-Based Help > Saving and Loading GanttView as an XML File > Saving GanttView as an XML File |
This task shows how to save the C1GanttView as an XML File at run time and in code.
To save the C1GanttView as an XML file at run time, complete the following:
&To save the C1GanttView as an XML file in code, complete the following:
To write code in Visual Basic
| Visual Basic |
Copy Code
|
|---|---|
Private Sub btnSaveXml_Click(sender As Object, e As EventArgs)
Using dlg As New SaveFileDialog()
dlg.DefaultExt = ".xml"
dlg.FileName = "gantt"
dlg.Filter = "XML files|*.xml|All files|*.*"
dlg.Title = "Save Gantt View As Xml File"
If dlg.ShowDialog() = DialogResult.OK Then
ganttView.SaveXml(dlg.FileName)
End If
End Using
End Sub
|
|
To write code in C#
| C# |
Copy Code
|
|---|---|
private void btnSaveXml_Click(object sender, EventArgs e)
{
using (SaveFileDialog dlg = new SaveFileDialog())
{
dlg.DefaultExt = ".xml";
dlg.FileName = "gantt";
dlg.Filter = "XML files|*.xml|All files|*.*";
dlg.Title = "Save Gantt View As Xml File";
if (dlg.ShowDialog() == DialogResult.OK)
{
ganttView.SaveXml(dlg.FileName);
}
}
}
|
|