MaskedTextProvider.Set 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將格式化字串設為指定的輸入字串。
多載
| 名稱 | Description |
|---|---|
| Set(String) |
將格式化字串設為指定的輸入字串。 |
| Set(String, Int32, MaskedTextResultHint) |
將格式化字串設為指定的輸入字串,然後輸出移除位置與描述資訊。 |
Set(String)
將格式化字串設為指定的輸入字串。
public:
bool Set(System::String ^ input);
public bool Set(string input);
member this.Set : string -> bool
Public Function Set (input As String) As Boolean
參數
傳回
true若所有字元皆成功設定;否則,。 false
例外狀況
參數 input 為 null。
備註
此 Set 方法會清除已格式化字串的現有內容,然後對字串套用遮罩 input 以更新格式化字串的內容。
以下條件被視為錯誤。 當發生錯誤時,格式化後的字串保持不變並 Set 返回 false。
格式化字串中可編輯的位置不足以容納替換字串的內容。
其中一個替換字元值不適用,因為它無法列印或與對應的遮罩元素不符。
另請參閱
適用於
Set(String, Int32, MaskedTextResultHint)
將格式化字串設為指定的輸入字串,然後輸出移除位置與描述資訊。
public:
bool Set(System::String ^ input, [Runtime::InteropServices::Out] int % testPosition, [Runtime::InteropServices::Out] System::ComponentModel::MaskedTextResultHint % resultHint);
public bool Set(string input, out int testPosition, out System.ComponentModel.MaskedTextResultHint resultHint);
member this.Set : string * int * MaskedTextResultHint -> bool
Public Function Set (input As String, ByRef testPosition As Integer, ByRef resultHint As MaskedTextResultHint) As Boolean
參數
- testPosition
- Int32
若成功,則為格式化字串中最後一個字元實際設定的位置為零;否則,操作失敗的第一個位置。 輸出參數。
- resultHint
- MaskedTextResultHint
MaskedTextResultHint A 簡潔地描述了集合運算的結果。 輸出參數。
傳回
true若所有字元皆成功設定;否則,。 false
例外狀況
參數 input 為 null。
備註
此 Set 方法會清除已格式化字串的現有內容,然後對字串套用遮罩 input 以更新格式化字串的內容。
以下條件被視為錯誤。 當發生錯誤時,格式化後的字串保持不變並 Set 返回 false。
格式化字串中可編輯的位置不足以容納替換字串的內容。
其中一個替換字元值不適用,因為它無法列印或與對應的遮罩元素不符。
此版本 Set 提供兩個額外的輸出參數,以傳達更多關於方法運作的資訊。