This task shows how to load the C1GanttView as an XML File at run time and in code.
To load the C1GanttView as an XML file at run time, complete the following:
To load the C1GanttView as an XML file in code, complete the following:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Private Sub btnLoadXml_Click(sender As Object, e As EventArgs) Using dlg As New OpenFileDialog() dlg.DefaultExt = ".xml" dlg.Filter = "XML files|*.xml|All files|*.*" dlg.Title = "Load Gantt View From Xml File" If dlg.ShowDialog() = DialogResult.OK Then Try ganttView.LoadXml(dlg.FileName) Catch MessageBox.Show("Bad C1GanttView XML.", dlg.Title) End Try End If End Using End Sub |
To write code in C#
C# |
Copy Code
|
---|---|
private void btnLoadXml_Click(object sender, EventArgs e) { using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.DefaultExt = ".xml"; dlg.Filter = "XML files|*.xml|All files|*.*"; dlg.Title = "Load Gantt View From Xml File"; if (dlg.ShowDialog() == DialogResult.OK) { try { ganttView.LoadXml(dlg.FileName); } catch { MessageBox.Show("Bad C1GanttView XML.", dlg.Title); } } } } |
In addition, you can load MS Project XML file in GanttView by using the ImportFromMsProjectXml method.