バージョン

SaveAsBinary(Stream,Boolean) メソッド

プロパティ、構造、およびデータの情報をバイナリストリームに保存します。
シンタックス
'宣言
 
Public Overloads Sub SaveAsBinary( _
   ByVal stream As Stream, _
   ByVal includeData As Boolean _
) 
public void SaveAsBinary( 
   Stream stream,
   bool includeData
)

パラメータ

stream
シリアル化された UltraDataSource 情報を含むストリーム。
includeData
データ構造と共にデータが保存されているかどうかを指定します。
解説

SaveAsBinary メソッドは、UltraDataSource のプロパティ設定およびレイアウトを永続化するために LoadFromBinary(Stream,Boolean) メソッドと組み合わせて使用します。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinDataSource


    Dim memoryStream As System.IO.MemoryStream = Nothing

    Private Sub SaveButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles saveButton.Click
        Me.memoryStream = New System.IO.MemoryStream()

        ' Save data to a stream. Pass in true for the includeData parameter
        ' to save data and not just the structure.
        Me.ultraDataSource1.SaveAsBinary(Me.memoryStream, True)
    End Sub

    Private Sub ClearDataSource_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearDataSource.Click
        Me.UltraDataSource1.Rows.Clear()
    End Sub

    Private Sub LoadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles loadButton.Click
        ' Make sure the Position is set to a location where the saved data
        ' begins.
        Me.MemoryStream.Position = 0

        ' Retrieve previously saved data from the stream. Pass in true for 
        ' the includeData parameter to save data and not just the structure.
        Me.UltraDataSource1.LoadFromBinary(Me.MemoryStream, True)
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinDataSource;
using System.Diagnostics;


		System.IO.MemoryStream memoryStream = null;

		private void saveButton_Click(object sender, System.EventArgs e)
		{
			this.memoryStream = new System.IO.MemoryStream( );

			// Save data to a stream. Pass in true for the includeData parameter
			// to save data and not just the structure.
			this.ultraDataSource1.SaveAsBinary( this.memoryStream, true );
		}

		private void clearDataSource_Click(object sender, System.EventArgs e)
		{
            this.ultraDataSource1.Rows.Clear( );		
		}

		private void loadButton_Click(object sender, System.EventArgs e)
		{
			// Make sure the Position is set to a location where the saved data
			// begins.
            this.memoryStream.Position = 0;			

			// Retrieve previously saved data from the stream. Pass in true for 
			// the includeData parameter to save data and not just the structure.
			this.ultraDataSource1.LoadFromBinary( this.memoryStream, true );
		}
参照