次の方法で共有


PasswordBox.Paste メソッド

定義

PasswordBox の現在の選択項目をクリップボードの内容と置き換えます。

public:
 void Paste();
public void Paste ();
member this.Paste : unit -> unit
Public Sub Paste ()

次の例は、メソッドを使用してコンテンツ PasswordBox を貼り付ける方法を Paste 示しています。

  // A TextBox will serve as a contrived means of putting our test 
  // password on the Clipboard.
  TextBox txtBox = new TextBox();
  PasswordBox pwdBox = new PasswordBox();

  // Put some content in the TextBox, and copy it to the Clipboard.
  txtBox.Text = "Open Sesame!";
  txtBox.SelectAll();
  txtBox.Copy();

  // Paste the contents of the Clipboard into the PasswordBox.  After this
  // call, the value of pwdBox.Password == "Open Sesame!".
  pwdBox.Paste();
' A TextBox will serve as a contrived means of putting our test 
' password on the Clipboard.
Dim txtBox As New TextBox()
Dim pwdBox As New PasswordBox()

' Put some content in the TextBox, and copy it to the Clipboard.
txtBox.Text = "Open Sesame!"
txtBox.SelectAll()
txtBox.Copy()

' Paste the contents of the Clipboard into the PasswordBox.  After this
' call, the value of pwdBox.Password == "Open Sesame!".
pwdBox.Paste()

注釈

このメソッドは、貼り付け前の内容を PasswordBox クリアしません。現在の選択範囲を貼り付けた内容に置き換えるか、貼り付けたコンテンツを現在のカーソル位置に挿入します。

適用対象