This task shows how to load the C1TileControl as an XML File at run time and in code.
Load C1TileControl as an XML file at run time
To load the C1TileControl as an XML file at run time, complete the following:
- Right-click the C1TileControl and select Load From XML File item from the context menu.
The Load From Xml File dialog box appears.
- Browse to the location you wish to load the xml file.
- Click Open in the Load From Xml File dialog box.
Load C1TileControl from XML file in code
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);
}
}
}
}
|