MaskedTextProvider.Add Method (String, Int32, MaskedTextResultHint)


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

Adds the characters in the specified input string to the end of the formatted string, and then outputs position and descriptive information.

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

public bool Add(
	string input,
	out int testPosition,
	out MaskedTextResultHint resultHint


Type: System.String

A String containing character values to be appended to the formatted string.

Type: System.Int32

The zero-based position in the formatted string where the attempt was made to add the character. An output parameter.

Type: System.ComponentModel.MaskedTextResultHint

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

Return Value

Type: System.Boolean

true if all the characters from the input string were added successfully; otherwise false to indicate that no characters were added.

The Add(String, Int32, MaskedTextResultHint) method adds the characters from the input string to the formatted string, starting with the first available position after LastAssignedPosition. This method will fail for any of the following reasons:

  • Any of the characters in the input value, input, are not printable, or the input value does not match its corresponding mask element.

  • There are not enough available edit positions in the formatted string after the last assigned position.

If this method fails, no additions are made and the method returns false.

This method functions the same as the overridden version taking a single String parameter, Add(String), except that it outputs additional information.

.NET Framework
Available since 2.0
Return to top