Can someone tell how to preserve the clipboard contents?

J

Just Me

Dim iData As IDataObject = Clipboard.GetDataObject()
Dim img As System.Drawing.Bitmap
img = img.FromFile(ofd.FileName, True)
Clipboard.SetDataObject(img)
TextControl1.Paste()
img.Dispose() : img = Nothing
Clipboard.SetDataObject(iData)

I want to insert an image and tried the above.
I wanted to not disturb the clipboard and didn't know how to do that so I
tried the first and last statements above. They produce an error.

Can someone tell how to preserve the clipboard contents?


Thanks
 
G

Guest

What is the goal of pasting into TextControl1?

Do you want the image bit's in the text box or the path to the file?

Joe
 
J

Just Me

The image itself.
But anyway, my mistake was thinking the code didn't work.
It's OK. The test was NG.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top