Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Gets the Microsoft.Office.Interop.Excel.Validation object that represents data validation for the XmlMappedRange control.
Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
Syntax
'Declaration
ReadOnly Property Validation As Validation
Get
Validation Validation { get; }
Property Value
Type: Microsoft.Office.Interop.Excel.Validation
The Microsoft.Office.Interop.Excel.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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.