バージョン

ErrorValue プロパティ

エラーの値を返します。
シンタックス
'宣言
 
Public ReadOnly Property ErrorValue As Object
public object ErrorValue {get;}
使用例
Private Sub ultraCalendarCombo1_ValidationError(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinSchedule.DateValidationErrorEventArgs) Handles ultraCalendarCombo1.ValidationError

    Dim info As String = String.Empty

    '	Use the ErrorValue property of the DateValidationErrorEventArgs to
    '	get the string representation of the bad value so we can display it
    '	to the end user
    Dim errorVal As String = "NULL"
    If (Not e.ErrorValue Is Nothing) Then
        errorVal = e.ErrorValue.ToString()
    End If

    '	Use the PrevValue property of the DateValidationErrorEventArgs to
    '	get the string representation of the last valid value so we can display it
    '	to the end user
    Dim prevVal As String = "NULL"
    If (Not e.PreviousValue Is Nothing) Then
        prevVal = e.PreviousValue.ToString()
    End If

    '	Use the ErrorCode property of the DateValidationErrorEventArgs to determine
    '	what caused the validation error to occur, and translate the error code into a
    '	string that will be more easily understood by the end user.
    Dim errorDesc As String = String.Empty
    Select Case (e.ErrorCode)
        Case Infragistics.Win.UltraWinSchedule.DateValidationError.AfterMaxDate
            errorDesc = "The value '" + errorVal + "' is greater than the maximum allowable date (" + Me.ultraCalendarCombo1.CalendarInfo.MaxDate.ToString() + ")."
        Case Infragistics.Win.UltraWinSchedule.DateValidationError.BeforeMinDate
            errorDesc = "The value '" + errorVal + "' is less than the minimum allowable date (" + Me.ultraCalendarCombo1.CalendarInfo.MinDate.ToString() + ")."
        Case Infragistics.Win.UltraWinSchedule.DateValidationError.NullValueNotAllowed
            errorDesc = "The value must be set to a valid date."
        Case Infragistics.Win.UltraWinSchedule.DateValidationError.UnableToParseValue
            errorDesc = "The value '" + errorVal + "' could not be interpreted as a valid date. Please check for typographical errors."
    End Select


    '	Build the information string that we will display in the message box
    info += errorDesc + vbCrLf + vbCrLf
    info += "Would you like to restore the value to the last valid value (" + prevVal + ")?" + vbCrLf
    info += "If you select 'No', the value will be set to the current date."

    '	Display the error dialog and prompt the user to see if they want
    '	to restore the control's last valid value, or change the value to the
    '	current date instead
    Dim result As DialogResult = MessageBox.Show(info, "Validation Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error)

    '	If the user selects 'No', then set the NewValue property of the
    '	DateValidationErrorEventArgs to the current date.
    If (result = DialogResult.No) Then
        e.NewValue = DateTime.Today
    End If

End Sub
private void ultraCalendarCombo1_ValidationError(object sender, Infragistics.Win.UltraWinSchedule.DateValidationErrorEventArgs e)
{

	string info = string.Empty;

	//	Use the ErrorValue property of the DateValidationErrorEventArgs to
	//	get the string representation of the bad value so we can display it
	//	to the end user
	string errorVal = "NULL";
	if ( e.ErrorValue != null )
		errorVal = e.ErrorValue.ToString();

	//	Use the PrevValue property of the DateValidationErrorEventArgs to
	//	get the string representation of the last valid value so we can display it
	//	to the end user
	string prevVal = "NULL";
	if ( e.PreviousValue != null )
		prevVal = e.PreviousValue.ToString();

	//	Use the ErrorCode property of the DateValidationErrorEventArgs to determine
	//	what caused the validation error to occur, and translate the error code into a
	//	string that will be more easily understood by the end user.
	string errorDesc = string.Empty;
	switch ( e.ErrorCode )
	{
		case Infragistics.Win.UltraWinSchedule.DateValidationError.AfterMaxDate:
		{
			errorDesc = "The value '" + errorVal + "' is greater than the maximum allowable date (" + this.ultraCalendarCombo1.CalendarInfo.MaxDate.ToString() + ").";
			break;
		}
		case Infragistics.Win.UltraWinSchedule.DateValidationError.BeforeMinDate:
		{
			errorDesc = "The value '" + errorVal + "' is less than the minimum allowable date (" + this.ultraCalendarCombo1.CalendarInfo.MinDate.ToString() + ").";
			break;
		}
		case Infragistics.Win.UltraWinSchedule.DateValidationError.NullValueNotAllowed:
		{
			errorDesc = "The value must be set to a valid date.";
			break;
		}
		case Infragistics.Win.UltraWinSchedule.DateValidationError.UnableToParseValue:
		{
			errorDesc = "The value '" + errorVal + "' could not be interpreted as a valid date. Please check for typographical errors.";
			break;
		}
	}	//	END switch

	//	Build the information string that we will display in the message box
	info += errorDesc + "\n" + "\n";
	info += "Would you like to restore the value to the last valid value (" + prevVal + ")?" + "\n";
	info += "If you select 'No', the value will be set to the current date.";

	//	Display the error dialog and prompt the user to see if they want
	//	to restore the control's last valid value, or change the value to the
	//	current date instead
	DialogResult result = MessageBox.Show( info, "Validation Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error );

	//	If the user selects 'No', then set the NewValue property of the
	//	DateValidationErrorEventArgs to the current date.
	if ( result == DialogResult.No )
		e.NewValue = DateTime.Today;

}
参照