(Excel Automation) Load Excel charts into VB.Net

I would like to plot (EXCEL) charts and display it in my VBA.

I have tried server methods

Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oWS As Excel.Worksheet
Dim oChart As Excel.Chart

oXL = CreateObject("Excel.Application")

Method 1)

Dim Idata As IDataObject = Clipboard.GetDataObject()
picturebox.image = CType(Idata.GetData(DataFormats.Bitmap), Image)

I try to copy the chart direclt but it fail. I found that the "picture" in clipboard is not in Bitmap format, but MetaFilePic and I don't know how to load the "picutre" into the picture box directly.

Method 2)
oWS.Range("B5", "H14").Select()
oWS.Range("B5", "H14").Copy()

Dim Idata As IDataObject = Clipboard.GetDataObject()
picturebox.image = CType(Idata.GetData(DataFormats.Bitmap), Image)

This time it works, I set the chart width and Height and paste it on B5:H14. However, sometimes it is diffcuclt to control the size of the chart and it is urgy.

Method 3)
Dim Fname As String
Dim myDataObject As New DataObject()

Fname = "c:\" & oWS.ChartObjects(1).Name & ".gif"
oWS.ChartObjects(1).chart.Export(FileName:=Fname, FilterName:="GIF")

picturebox.Image = Image.FromFile(Fname)

This method also work, but I think this method is not good because I will generate many files. On the otherhand, once I load the file, I can't kill it because the system is using the gif(file violation).

Can someone teach me how to load the (EXCEL) Charts into VB.net?
If yes, can you post the syntax? Thx
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I would say method 3 as the best in case u want to use the 'Excel' for chart in vb. yes u shall get a lot of files but then u can clean the file once u r through. like on closing the application or on startup just make sure that the files are in a folder and empty the folder on either the unload or load.
leokwan2000Author Commented:
This method works, hope it can help others.

        Fname = "c:\" & oWS.ChartObjects(1).Name & ".gif"
        oWS.ChartObjects(1).chart.Export(FileName:=Fname, FilterName:="GIF")

        Dim myReader As FileStream = File.OpenRead(Fname)
        picturebox1.Image = Image.FromStream(myReader)

        Catch exc As Exception
            ' Show error to user.
            MsgBox("no hope")
        End Try

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
refund points
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.