Partager via


TextBuffer.fromClipboard Method

Definition

Replaces the content of the TextBuffer object with the content of the clipboard.

public:
 virtual bool fromClipboard();
public virtual bool fromClipboard ();
abstract member fromClipboard : unit -> bool
override this.fromClipboard : unit -> bool
Public Overridable Function fromClipboard () As Boolean

Returns

true if the replacement was successful; otherwise, false.

Remarks

The following example demonstrates the fromClipboard method.

{ 
    TextBuffer txtb = new textBuffer(); 
    FileIoPermission perm; 
    #define.ExampleFile(@"c:\test.txt") 
    #define.ExampleOpenMode("w") 
    // Set code access permission to help protect the use of 
    // TextBuffer.tofile 
    perm = new FileIoPermission(#ExampleFile, #ExampleOpenMode); 
    perm.assert(); 
    if ( txtb.fromClipboard() ) 
    { 
        // Got text from clipboard - save it to file 
        txtb.toFile(#ExampleFile); 
    } 
    // Close the code access permission scope. 
    CodeAccessPermission::revertAssert(); 
}

Applies to