MaskedTextProvider::Set Method (String^, Int32%, MaskedTextResultHint%)

 

Sets the formatted string to the specified input string, and then outputs the removal position and descriptive information.

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

public:
bool Set(
	String^ input,
	[OutAttribute] int% testPosition,
	[OutAttribute] MaskedTextResultHint% resultHint
)

Parameters

input
Type: System::String^

The String value used to set the formatted string.

testPosition
Type: System::Int32%

If successful, the zero-based position in the formatted string where the last character was actually set; otherwise, the first position where the operation failed. An output parameter.

resultHint
Type: System.ComponentModel::MaskedTextResultHint%

A MaskedTextResultHint that succinctly describes the result of the set operation. An output parameter.

Return Value

Type: System::Boolean

true if all the characters were successfully set; otherwise, false.

Exception Condition
ArgumentNullException

The input parameter is null.

The Set method clears the existing contents of the formatted string and then applies the mask against the input string to update the contents of the formatted string.

The following conditions are considered errors. When an error occurs, the formatted string remains unaltered and Set returns false.

  • There are not enough editable positions in the formatted string to hold the contents of the replacement string.

  • One of the replacement character values is not valid because it is not printable or does not match its corresponding mask element.

This version of Set provides two additional output parameters to convey more information about the operation of the method.

.NET Framework
Available since 2.0
Return to top
Show: