Dela via


XmlMappedRange.Validation Property (2007 System)

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

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property Validation As Validation
'Usage
Dim instance As XmlMappedRange 
Dim value As Validation 

value = instance.Validation
[BrowsableAttribute(false)]
public Validation Validation { get; }
[BrowsableAttribute(false)]
public:
property Validation^ Validation {
    Validation^ get ();
}
public function get Validation () : Validation

Property Value

Type: Validation
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 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
private void SetValidation()
{
    this.CustomerLastNameCell.Validation.Add(
        Excel.XlDVType.xlValidateTextLength, 
        Excel.XlDVAlertStyle.xlValidAlertInformation,
        Excel.XlFormatConditionOperator.xlGreaterEqual, 3, missing);

    this.CustomerLastNameCell.Validation.ErrorMessage = 
        "You must enter a name with three or more letters.";
}

.NET Framework Security

See Also

Reference

XmlMappedRange Class

XmlMappedRange Members

Microsoft.Office.Tools.Excel Namespace