LoadFromXml メソッドは、ultraDataSource の構造およびデータを永続化するために SaveAsXml(String) メソッドと組み合わせて使用します。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinDataSource Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles saveButton.Click ' Following code saves the data to an XML file for loading at ' a later time. Dim saveFileDlg As SaveFileDialog = New SaveFileDialog() saveFileDlg.Filter = "XML File|*.xml" saveFileDlg.OverwritePrompt = True Dim dialogResult As DialogResult = saveFileDlg.ShowDialog(Me) If dialogResult.OK = dialogResult Then ' Pass in true for the includeData parameter to save the data ' otherwise it will only save the structure. ' Me.ultraDataSource1.SaveAsXml(saveFileDlg.FileName, True) End If End Sub Private Sub LoadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles loadButton.Click ' Following code loads previously saved data from a file. Dim openFileDlg As OpenFileDialog = New OpenFileDialog() openFileDlg.Filter = "XML File|*.xml" Dim dialogResult As DialogResult = openFileDlg.ShowDialog(Me) If dialogResult.OK = dialogResult Then ' Pass in true for the includeData parameter to load the data ' and not just the structure. ' Me.ultraDataSource1.LoadFromXml(openFileDlg.FileName, True) End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinDataSource; using System.Diagnostics; private void saveButton_Click(object sender, System.EventArgs e) { // Following code saves the data to an XML file for loading at // a later time. SaveFileDialog saveFileDlg = new SaveFileDialog( ); saveFileDlg.Filter = "XML File|*.xml"; saveFileDlg.OverwritePrompt = true; DialogResult dialogResult = saveFileDlg.ShowDialog( this ); if ( DialogResult.OK == dialogResult ) { // Pass in true for the includeData parameter to save the data // otherwise it will only save the structure. // this.ultraDataSource1.SaveAsXml( saveFileDlg.FileName, true ); } } private void loadButton_Click(object sender, System.EventArgs e) { // Following code loads previously saved data from a file. OpenFileDialog openFileDlg = new OpenFileDialog( ); openFileDlg.Filter = "XML File|*.xml"; DialogResult dialogResult = openFileDlg.ShowDialog( this ); if ( DialogResult.OK == dialogResult ) { // Pass in true for the includeData parameter to load the data // and not just the structure. // this.ultraDataSource1.LoadFromXml( openFileDlg.FileName, true ); } }