This task shows how to load the C1TileControl as an XML File at run time and in code.
To load the C1TileControl as an XML file at run time, complete the following:
The Load From Xml File dialog box appears.
To load template1 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 From Xml File" If dlg.ShowDialog() = DialogResult.OK Then Try template1.LoadXml(dlg.FileName) Catch MessageBox.Show("Bad tilecontrol 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 From Xml File"; if (dlg.ShowDialog() == DialogResult.OK) { try { Tilecontrol.LoadXml(dlg.FileName); } catch { MessageBox.Show("Bad tilecontrol XML.", dlg.Title); } } } } |