p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language

Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 30th, 2009, 01:07 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Sharing violation error while exporting an excel chart to an image

Hi all..i really need help here..
I build a windows application that can display an excel chart in a picture box, where the data to display the chart is coming from the sql db. The chart initially displayed in the excel file and i need to export the chart as an bmp image to the C://path, so that i can display it in the picture box of the windows form. This situation was successfully achieved only if try to display the chart (that already converted as bmp & displayed in the picture box) by clicking a button at the 1st time. The problem started when i try to display the chart again at the 2nd time. It throws the following exception :

A share violation has occurred. (Exception from HRESULT: 0x80030020 (STG_E_SHAREVIOLATION))

I think this problem appear when i try to export the chart as the image at the same path while its cannot overwrite that path.
Below is the snipped codes that i used in my program:

Excel.Range xRange;
Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type. Missing);
Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 300, 300);
Excel.Chart xChart = myChart.Chart;

//display the chart
xRange = xlWorkSheet.get_Range("A1", "M3");
xChart.SetSourceData(xRange, misValue);

//export chart as picture file
xChart.Export(@"C:\excel_chart_export.bmp", "BMP", misValue);

//load picture to picturebox
pictureBox1.Image = new Bitmap(@"C:\excel_chart_export.bmp");


The error was highlighted on the export chart as picture file part..Can anyone please help me to overcome this..i really appreciate ur help..tq a lot..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Received sharing violation occur on .php file Snowby Pro PHP 0 April 9th, 2008 09:18 AM
dll error while exporting to Excel lily611 General .NET 2 June 15th, 2005 12:43 AM
Exporting chart to gif in asp.net spacy General .NET 1 April 11th, 2005 06:49 AM
Exporting chart to gif spacy ASP.NET 1.1 0 August 11th, 2004 04:10 AM
Exporting/Importing error to EXCEL haasf Access 1 December 4th, 2003 09:37 AM



All times are GMT -4. The time now is 04:34 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc