Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 17th, 2005, 3:42 PM   #1
Elder_Newb
Newbie
 
Join Date: Feb 2005
Posts: 1
Rep Power: 0 Elder_Newb is on a distinguished road
Question Question for adding to Clipboard

Hello, is there such a func that allows you to add (via a button click) to the clipboard.. say what is typed in the text feild? thanks
Elder_Newb is offline   Reply With Quote
Old Feb 17th, 2005, 4:48 PM   #2
melbolt
Professional Programmer
 
melbolt's Avatar
 
Join Date: Feb 2005
Location: PA, USA
Posts: 253
Rep Power: 4 melbolt is on a distinguished road
Quote:
Originally Posted by Elder_Newb
Hello, is there such a func that allows you to add (via a button click) to the clipboard.. say what is typed in the text feild? thanks
Hi there, I have never done this myself but I found a code snippet which will explain it.

Private Sub button1_Click(sender As Object, e As System.EventArgs)
    ' Takes the selected text from a text box and puts it on the clipboard.
    If textBox1.SelectedText <> "" Then
        Clipboard.SetDataObject(textBox1.SelectedText)
    Else
        textBox2.Text = "No text selected in textBox1"
    End If
End Sub 'button1_Click
 
Private Sub button2_Click(sender As Object, e As System.EventArgs)
    ' Declares an IDataObject to hold the data returned from the clipboard.
    ' Retrieves the data from the clipboard.
    Dim iData As IDataObject = Clipboard.GetDataObject()
    
    ' Determines whether the data is in a format you can use.
    If iData.GetDataPresent(DataFormats.Text) Then
        ' Yes it is, so display it in a text box.
        textBox2.Text = CType(iData.GetData(DataFormats.Text), String)
    Else
        ' No it is not.
        textBox2.Text = "Could not retrieve data off the clipboard."
    End If
End Sub 'button2_Click


i recommend reading the whole page on it which can be found Here

hope this helps
melbolt is offline   Reply With Quote
Old Feb 17th, 2005, 5:55 PM   #3
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road

just to make it a bit simpler
Clipboard.Clear 'Clears the current clipboard data
Clipboard.SetText (TextBoxName.Text) 'Adds the text to clipboard
cloud- is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:05 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC