TextBuffer.fromClipboard Method [AX 2012]
Replaces the content of the TextBuffer object with the content of the clipboard.
{
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();
}
Community Additions
ADD
Show: