System.ComponentModel.MaskedTextProvider.RemoveAt C# (CSharp) Метод

RemoveAt() публичный Метод

Removes all characters in edit position from in the test string at the specified start and end positions and shifts any remaining characters left. On exit the testPosition contains last position where the primary operation was actually performed if successful, otherwise the first position that made the test fail. This position is relative to the test string. The MaskedTextResultHint out param gives more information about the operation result. Returns true on success, false otherwise.
public RemoveAt ( int startPosition, int endPosition, int &testPosition, MaskedTextResultHint &resultHint ) : bool
startPosition int
endPosition int
testPosition int
resultHint MaskedTextResultHint
Результат bool
        public bool RemoveAt(int startPosition, int endPosition, out int testPosition, out MaskedTextResultHint resultHint)
        {
            if (endPosition >= _testString.Length)
            {
                testPosition = endPosition;
                resultHint = MaskedTextResultHint.PositionOutOfRange;
                return false;
                //throw new ArgumentOutOfRangeException("endPosition");
            }

            if (startPosition < 0 || startPosition > endPosition)
            {
                testPosition = startPosition;
                resultHint = MaskedTextResultHint.PositionOutOfRange;
                return false;
                //throw new ArgumentOutOfRangeException("startPosition");
            }

            return RemoveAtInt(startPosition, endPosition, out testPosition, out resultHint, /*testOnly*/ false);
        }

Same methods

MaskedTextProvider::RemoveAt ( int position ) : bool
MaskedTextProvider::RemoveAt ( int startPosition, int endPosition ) : bool

Usage Example

Пример #1
0
        private bool CanDelete( int startPosition, int selectionLength, bool deleteForward, MaskedTextProvider provider )
        {
            if( this.IsReadOnly )
            return false;

              if( selectionLength == 0 )
              {
            if( !deleteForward )
            {
              if( startPosition == 0 )
            return false;

              startPosition--;
            }
            else if( ( startPosition + selectionLength ) == provider.Length )
            {
              return false;
            }
              }

              MaskedTextResultHint notUsed;
              int tentativeCaretPosition = startPosition;

              int endPosition = ( selectionLength > 0 ) ? ( ( startPosition + selectionLength ) - 1 ) : startPosition;

              bool success = provider.RemoveAt( startPosition, endPosition, out tentativeCaretPosition, out notUsed );

              return success;
        }
All Usage Examples Of System.ComponentModel.MaskedTextProvider::RemoveAt