TextBuffer.fromClipboard Method
Replaces the content of the TextBuffer object with the content of the clipboard.
Syntax
public boolean fromClipboard()
Run On
Called
Return Value
Type: boolean
true if the replacement was successful; otherwise, false.
Examples
{
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();
}