The following sample code retrieves the contents of the CustomTextBuffer by placing it on the Clipboard, then printing the Clipboard contents:
// Go to beginning of text field CustomTextBuffer.TypeKeys ("<Ctrl-Home>") // Highlight it CustomTextBuffer.TypeKeys ("<Ctrl-Shift-End>") // Copy it to the Clipboard CustomTextBuffer.TypeKeys ("<Ctrl-Insert>") // Print the contents of the Clipboard Print (Clipboard.GetText())
Similarly, the following sample code inserts text into the custom object by pasting it from the Clipboard:
// Go to beginning of text field CustomTextBuffer.TypeKeys ("<Ctrl-Home>") // Highlight it CustomTextBuffer.TypeKeys ("<Ctrl-Shift-End>") // Paste the Clipboard contents into the text field CustomTextBuffer.TypeKeys ("<Shift-Insert>")
You can wrap this functionality in GetText and SetText methods you define for your custom class, similar to what was shown in supporting custom text boxes.