Copy to Clipboard

This forum can be browsed by the general public. Posting is no longer allowed as the product has been discontinued.
This topic is 13 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
gnana
Posts: 3
Last visit: Fri May 28, 2010 4:33 am

Copy to Clipboard

Post by gnana »

Hi, I am developing a tool using Primal form 2009. How to copy the content of a text box to clipboard.I have $textbox1 and $button1. When I click on $button1, it should copy the content of $textbox1 and I should be able to past it in other applications. Is there a way to doing this ??ThanksGnana
User avatar
Ferdinand Rios
Posts: 373
Last visit: Fri Sep 16, 2022 1:24 pm

Copy to Clipboard

Post by Ferdinand Rios »

In the code for your button click, add the following:

[System.Windows.Forms.Clipboard]::SetText($textbox1.text)

That copies the contents of the textbox to the clipboard. If you package this form make sure you select the STA option as clipboard functions need to be in STA mode.
F.G. Rios
This topic is 13 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.