Export (0) Print
Expand All

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 (
	char input,
	int position
)
public boolean Replace (
	char input, 
	int position
)
public function Replace (
	input : char, 
	position : int
) : boolean
Not applicable.

Parameters

input

The Char value that replaces the existing value.

position

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

Return Value

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.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft