Can someone tell how to preserve the clipboard contents?

  • Thread starter Thread starter Just Me
  • Start date Start date
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
 
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
 
The image itself.
But anyway, my mistake was thinking the code didn't work.
It's OK. The test was NG.

Thanks
 
Back
Top