'宣言 Public Property InvalidValueBehavior As InvalidValueBehavior
public InvalidValueBehavior InvalidValueBehavior {get; set;}
InvalidValueBehavior プロパティは、ユーザーが無効な値を入力してセルを離れようとしたときの動作を指定します。このプロパティは、UltraGrid.CellDataError イベントが発生したときの、CellDataErrorEventArgs のプロパティのデフォルト値を提供します。したがって、このイベントをフックしてイベント引数のプロパティを設定することにより、同じ機能を実現できます。このイベント引数は動作のその他の側面を制御するプロパティも公開しています。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ultraGrid1.InitializeLayout ' InvalidValueBehavior controls what happens when the user attempts to leave ' a cell after typing an invalid value. A value is considered to be invalid ' if it can't be converted to the data type of the column or if it doesn't ' meet the any of constraints specified on the column like the MaxValue, ' MinValue etc... Note: To further fine-grain the behavior hook into the ' CellDataError event. The associated event args exposes various properties ' that let you do the same as this property and in addition let you prevent ' the error message box from displaying. e.Layout.Override.InvalidValueBehavior = InvalidValueBehavior.RevertValue End Sub Private Sub UltraGrid1_CellDataError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs) Handles ultraGrid1.CellDataError ' Prevent the message box from displaying. e.RaiseErrorEvent = False End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { // InvalidValueBehavior controls what happens when the user attempts to leave // a cell after typing an invalid value. A value is considered to be invalid // if it can't be converted to the data type of the column or if it doesn't // meet the any of constraints specified on the column like the MaxValue, // MinValue etc... Note: To further fine-grain the behavior hook into the // CellDataError event. The associated event args exposes various properties // that let you do the same as this property and in addition let you prevent // the error message box from displaying. e.Layout.Override.InvalidValueBehavior = InvalidValueBehavior.RevertValue; } private void ultraGrid1_CellDataError(object sender, Infragistics.Win.UltraWinGrid.CellDataErrorEventArgs e) { // Prevent the message box from displaying. e.RaiseErrorEvent = false; }