470,641 Members | 1,567 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Displaying Excel chart image in Picturebox using VB.net

In the old days of VB6, an Excel chart image could be
pasted into a picture box with Clipboard using the
following commands.

xlApp.ActiveChart.ChartArea.Copy
Picture1.Picture = Clipboard.GetData()
I having problems doing this in VB.net? I tried the code
shown below, but it does not work. Its a modified version
of a Clipboard-bitmap example I found on the Microsoft
support site. I believe Excel Chart images copied onto
Clipboard as a enchanced metafile.

xlApp.ActiveChart.ChartArea.Copy

Dim oDataObj As IDataObject =
System.Windows.Forms.Clipboard.GetDataObject()

If Not System.Windows.Forms.Clipboard.GetDataObject() Is
Nothing Then

If oDataObj.GetDataPresent
(System.Windows.Forms.DataFormats.MetafilePict) Then
PictureBox1.Image = oDataObj.GetData
(DataFormats.EnhancedMetafile, True)
End If

End If
Please help!
Jul 21 '05 #1
0 3534

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Allison Bailey | last post: by
reply views Thread by pmclinn | last post: by
6 posts views Thread by Thelma Lubkin | last post: by
reply views Thread by Marcus Kwok | last post: by
9 posts views Thread by AGP | last post: by
1 post views Thread by Korara | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.