'宣言 Public ReadOnly Property Editor As Infragistics.Win.EmbeddableEditorBase
public Infragistics.Win.EmbeddableEditorBase Editor {get;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinListView Private Sub ultraListView1_EditError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.EditErrorEventArgs) Handles ultraListView1.EditError ' Set the 'DisplayMessageBox' property to false so that ' the default MessageBox does not appear e.DisplayMessageBox = False ' Show a MessageBox with some additional information about the error Dim message As String = String.Format("The value '{0}' is not valid. Would you like to revert to the last valid value?", e.Editor.CurrentEditText) Dim result As DialogResult = MessageBox.Show(message, "Invalid value entered", MessageBoxButtons.YesNo, MessageBoxIcon.Information) ' If the user elected to revert to the original value, ' set the 'RestoreOriginalValue' property to true If result = DialogResult.Yes Then e.RestoreOriginalValue = True e.StayInEditMode = False Else e.RestoreOriginalValue = False e.StayInEditMode = True End If End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinListView; using System.Diagnostics; private void ultraListView1_EditError(object sender, Infragistics.Win.UltraWinListView.EditErrorEventArgs e) { // Set the 'DisplayMessageBox' property to false so that // the default MessageBox does not appear e.DisplayMessageBox = false; // Show a MessageBox with some additional information about the error string message = string.Format( "The value '{0}' is not valid. Would you like to revert to the last valid value?", e.Editor.CurrentEditText ); DialogResult result = MessageBox.Show( message, "Invalid value entered", MessageBoxButtons.YesNo, MessageBoxIcon.Information ); // If the user elected to revert to the original value, // set the 'RestoreOriginalValue' property to true if ( result == DialogResult.Yes ) { e.RestoreOriginalValue = true; e.StayInEditMode = false; } else { e.RestoreOriginalValue = false; e.StayInEditMode = true; } }