MaskedTextProvider.Set Method (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Sets the formatted string to the specified input string.

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

public bool Set(
	string input


Type: System.String

The String value used to set the formatted string.

Return Value

Type: System.Boolean

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

Exception Condition

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.

.NET Framework
Available since 2.0
Return to top