What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Trying to copy some text to the clipboard

Trying to copy some text to the clipboard
Author: Message:
J-Thread
Full Member
***

Avatar

Posts: 467
Reputation: 8
– / Male / –
Joined: Jul 2004
RE: Trying to copy some text to the clipboard
How about using the Clipboard object? (following code copied directly from the MSDN without testing):

code:
private function button1_Click(sender : Object, e : System.EventArgs) {
    //Take the selected text from a text box and put it on the clipboard.
    if(textBox1.SelectedText != "")
       Clipboard.SetDataObject(textBox1.SelectedText);
    else
       textBox2.Text = "No text selected in textBox1";
}

private function button2_Click(sender : Object, e : System.EventArgs) {
    //Declare an IDataObject to hold the data returned from the clipboard.
    //Then retrieve the data from the clipboard.
    var iData : IDataObject = Clipboard.GetDataObject();

    //Determine whether the data is in a format you can use.
    if(iData.GetDataPresent(DataFormats.Text)) {
       //Yes it is, so display it in a text box.
       textBox2.Text = String(iData.GetData(DataFormats.Text));
    }
    else {
       //No it is not.
       textBox2.Text = "Could not retrieve data off the clipboard.";
    }
}

07-07-2006 10:48 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Trying to copy some text to the clipboard - by segosa on 07-07-2006 at 04:27 PM
RE: Trying to copy some text to the clipboard - by J-Thread on 07-07-2006 at 10:48 PM
RE: Trying to copy some text to the clipboard - by RaceProUK on 07-07-2006 at 10:55 PM
RE: Trying to copy some text to the clipboard - by J-Thread on 07-07-2006 at 11:00 PM
RE: Trying to copy some text to the clipboard - by Dhaya on 07-07-2006 at 11:28 PM
RE: Trying to copy some text to the clipboard - by Eljay on 07-08-2006 at 07:43 AM
RE: Trying to copy some text to the clipboard - by J-Thread on 07-08-2006 at 11:02 AM
RE: Trying to copy some text to the clipboard - by andrey on 07-12-2006 at 02:26 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On