469,646 Members | 1,558 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,646 developers. It's quick & easy.

Can someone tell how to preserve the clipboard contents?


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
Nov 21 '05 #1
2 1424
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

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

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

Thanks

"jam96-BuffaloJoe" <ja*************@discussions.microsoft.com> wrote in
message news:A5**********************************@microsof t.com...
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

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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by lgbjr | last post: by
16 posts views Thread by ad | last post: by
5 posts views Thread by exhuma.twn | last post: by
2 posts views Thread by =?Utf-8?B?SkRSYXZlbg==?= | last post: by
6 posts views Thread by Adam Sandler | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.