MaskedTextProvider::Replace Method (Char, Int32)

 

Replaces a single character at or beyond the specified position with the specified character value.

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

public:
bool Replace(
	wchar_t input,
	int position
)

Parameters

input
Type: System::Char

The Char value that replaces the existing value.

position
Type: System::Int32

The zero-based position to search for the first editable character to replace.

Return Value

Type: System::Boolean

true if the character was successfully replaced; otherwise, false.

The Replace(Char, Int32) method searches for the first editable position in the formatted string at or beyond the specified position, pos. If one is found, the value of the editable position is changed to the specified character, input. Any of the following conditions will result in an error that causes no replacement to be performed and a value of false to be returned:

  • The pos parameter is less than zero or greater than the Length of the formatted string.

  • An editable character was not found in the formatted string at or beyond the specified position, pos.

  • The replacement character, input, is not a valid input character because it is not printable or does not match its corresponding mask element.

.NET Framework
Available since 2.0
Return to top
Show: