XmlMappedRange.Validation Property

Definition

Gets the Validation object that represents data validation for the XmlMappedRange control.

public:
 property Microsoft::Office::Interop::Excel::Validation ^ Validation { Microsoft::Office::Interop::Excel::Validation ^ get(); };
public Microsoft.Office.Interop.Excel.Validation Validation { get; }
member this.Validation : Microsoft.Office.Interop.Excel.Validation
Public ReadOnly Property Validation As Validation

Property Value

The Validation object that represents data validation for the XmlMappedRange control.

Examples

The following code example uses the Validation property to display a validation error if fewer than three characters are entered into an XmlMappedRange. This code example assumes that the current worksheet contains an XmlMappedRange named CustomerLastNameCell.

private void SetValidation()
{
    this.CustomerLastNameCell.Validation.Add(
        Excel.XlDVType.xlValidateTextLength, 
        Excel.XlDVAlertStyle.xlValidAlertInformation,
        Excel.XlFormatConditionOperator.xlGreaterEqual, 3);

    this.CustomerLastNameCell.Validation.ErrorMessage = 
        "You must enter a name with three or more letters.";
}
Private Sub SetValidation()
    Me.CustomerLastNameCell.Validation.Add( _
        Excel.XlDVType.xlValidateTextLength, _
        Excel.XlDVAlertStyle.xlValidAlertInformation, _
        Excel.XlFormatConditionOperator.xlGreaterEqual, 3)

    Me.CustomerLastNameCell.Validation.ErrorMessage = _
        "You must enter a name with three or more letters."
End Sub

Applies to