System.ComponentModel.MaskedTextProvider.InsertAt C# (CSharp) Method

InsertAt() public method

Attempts to insert the specified character at the specified position in the test string. (Insert character in the virtual string). Returns true on success, false otherwise.
public InsertAt ( char input, int position ) : bool
input char
position int
return bool
        public bool InsertAt(char input, int position)
        {
            if (position < 0 || position >= _testString.Length)
            {
                return false;
                //throw new ArgumentOutOfRangeException("position");
            }

            return InsertAt(input.ToString(), position);
        }

Same methods

MaskedTextProvider::InsertAt ( char input, int position, int &testPosition, MaskedTextResultHint &resultHint ) : bool
MaskedTextProvider::InsertAt ( string input, int position ) : bool
MaskedTextProvider::InsertAt ( string input, int position, int &testPosition, MaskedTextResultHint &resultHint ) : bool

Usage Example

Example #1
0
        private bool PlaceCharCore( MaskedTextProvider provider, char ch, int startPosition, int length, bool overwrite, out int caretPosition )
        {
            caretPosition = startPosition;

              if( startPosition < m_maskedTextProvider.Length )
              {
            MaskedTextResultHint notUsed;

            if( length > 0 )
            {
              int endPosition = ( startPosition + length ) - 1;
              return provider.Replace( ch, startPosition, endPosition, out caretPosition, out notUsed );
            }

            if( overwrite )
              return provider.Replace( ch, startPosition, out caretPosition, out notUsed );

            return provider.InsertAt( ch, startPosition, out caretPosition, out notUsed );
              }

              return false;
        }
All Usage Examples Of System.ComponentModel.MaskedTextProvider::InsertAt