I have tried to modify the msdn example but I have not succeeded. I have
tried their example code and it works. The example copies test from notepad
or text box. I want to be able to transfer a selected filename from a
windows explorer pane into my application, a textbox for example. The
following code, taken from msdn works for text. How would I modify it to
make it extract the filename as I have described above.
I used another example to get the dataformats from the clipboard object and
FileName was one of the items listed. However, when I try to change "text"
in the example below to 'FileName" it doesn't work.
I suspect a minor fix would solve my problem.
Thanks
Hamil.
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
"Cor Ligthert [MVP]" wrote:
Hamil,
There are many (good) samples for that in MSDN.
http://msdn2.microsoft.com/en-us/lib...clipboard.aspx
I hope this helps,
Cor