バージョン

UpdateMode プロパティ

データソース内での情報の更新方法を決定する値を返すか、設定します。
シンタックス
'宣言
 
Public Property UpdateMode As UpdateMode
public UpdateMode UpdateMode {get; set;}
解説

このプロパティは、更新をいつデータソースにコミットするかを指定するために使用します。ユーザー インタラクションに基づいて行またはセルの変更時にコミットするか、または UpdateData メソッドが呼び出されたときにプログラム上でコミットするかを選択できます。

このプロパティが OnRowChange または OnCellChange に設定されている場合は、それぞれ変更された行またはセルからユーザーがフォーカスを移動したときに、更新がデータソースにコミットされます。変更されたセルがフォーカスを失うと、そのセルの DataChanged プロパティが True に設定され、BeforeCellUpdate イベントが生成されます。同様に、変更された行がフォーカスを失うと、その DataChanged プロパティが True に設定され、BeforeRowUpdate イベントが生成されます。

このプロパティが OnUpdate に設定されている場合は、UpdateData メソッドが呼び出されるか、またはバインディング マネージャから EndEdit が受信されるまで、更新は実際にはデータソースにコミットされません。場合によっては、Position が変更されるたびにバインディング マネージャによって EndEdit が呼び出されることがあります。この場合は、OnUpdate の設定は使用されません。この動作はバインディング マネージャの実装によるもので、コンポーネントによって制御することはできません。

更新できないデータソースを更新しようとすると、Error イベントが生成されます。

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

Private Sub Form1_Load(sender as object, e as System.EventArgs) Handles MyBase.Load
	
	Me.OleDbDataAdapter1.Fill( Me.DataSet21 )

	' Bind the UltraGrid to a data source whose underlying row objects implement
	' IEditableObject interface to demonstrate the UpdateData method.
	Me.UltraGrid1.DataSource = Me.DataSet21

      ' Set the UpdateMode to OnRowChange. BeforeRowUpdate event handler below prints
      ' out whenever a row is being updated.
      Me.ultraGrid1.UpdateMode = UpdateMode.OnRowChange

End Sub
		
  Private Sub UltraGrid1_BeforeRowUpdate(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelableRowEventArgs) Handles ultraGrid1.BeforeRowUpdate

      ' Following code will write out whenever the row is being updated to illustate when a
      ' modified row gets updated with various UpdateMode settings.

      Debug.WriteLine("Canceling the row update on row with list index of " & e.Row.ListIndex)

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void Form1_Load(object sender, System.EventArgs e)
{		
	
	this.oleDbDataAdapter1.Fill( this.dataSet21 );	

	// Bind the UltraGrid to a data source whose underlying row objects implement
	// IEditableObject interface to demonstrate the UpdateData method.
	this.ultraGrid1.DataSource = this.dataSet21;

	// Set the UpdateMode to OnRowChange. BeforeRowUpdate event handler below prints
	// out whenever a row is being updated.
	this.ultraGrid1.UpdateMode = UpdateMode.OnRowChange;

}
		
private void ultraGrid1_BeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
{

	// Following code will write out whenever the row is being updated to illustate when a
	// modified row gets updated with various UpdateMode settings.

	Debug.WriteLine( "Canceling the row update on row with list index of " + e.Row.ListIndex );

}
参照