MaskedTextProvider::InsertAt Method (Char, Int32, Int32%, MaskedTextResultHint%)
Inserts the specified character at the specified position within the formatted string, returning the last insertion position and the status of the operation.
Assembly: System (in System.dll)
public: bool InsertAt( wchar_t input, int position, [OutAttribute] int% testPosition, [OutAttribute] MaskedTextResultHint% resultHint )
Parameters
- input
-
Type:
System::Char
The Char to be inserted.
- position
-
Type:
System::Int32
The zero-based position in the formatted string to insert the character.
- testPosition
-
Type:
System::Int32%
If the method is successful, the last position where a character was inserted; otherwise, the first position where the insertion failed. An output parameter.
- resultHint
-
Type:
System.ComponentModel::MaskedTextResultHint%
A MaskedTextResultHint that succinctly describes the result of the insertion operation. An output parameter.
The InsertAt method inserts a character into the first edit position at or beyond that specified by the pos parameter. This method will shift all existing characters after the insertion point over by one position to make room for the inserted input character. If one of the following errors occurs, the insertion is not performed, and the method returns false.
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 insertion character, input, is not a valid input character because it is not printable or does not match its corresponding mask element.
There are no available positions to the right of the insertion point, so that existing characters cannot be shifted.
Shifting the existing characters would produce a violation of the mask.
An empty input string will cause no change in the formatted string, but will return true.
Available since 2.0