MsChart error message in VB 2005

S

steve

Using Mschart in VB.net 2005

I get the error 'System.ExecutionEngineException' when I run the print code
below..


The Graph display data OK on the form

code..................................................................
My.Computer.Clipboard.Clear()

MSChart1.EditCopy()

If My.Computer.Clipboard.GetDataObject.GetDataPresent(DataFormats.Bitmap)
Then ******** get error here

bmpGraph =
System.Windows.Forms.Clipboard.GetDataObject.GetData(System.Windows.Forms.DataFormats.Bitmap)

End If

drawFormat.FormatFlags = StringFormatFlags.NoWrap

' Draw string to screen.

e.Graphics.DrawString(lbltitle.Text, drawFont, drawBrush, _

x, y, drawFormat)

e.Graphics.DrawImage(bmpGraph, 100, 100, 1000, 550)

.....................................................................................................

Any ideas

Regards
steve
 
L

Luke Zhang [MSFT]

Hello Steve,

I also got an exception with following code:

AxMSChart1.EditCopy()
MsgBox(My.Computer.Clipboard.ContainsImage)

MSChart1 is an COM component. The image it copied also in COM format. It
seems that the image data cannot be used in .NET managed code.

I think there two work arounds:
1. User Chart control in MS Office.
2. In VB 6.0 or VC 6.0, create a user control with MSchart control in it
and implement the print function in the user control, and use this control
in .NET framework.

Regards,

Luke Zhang
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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