C# and OWC

E

Edward

Hello, everyone here.

I got several OWC chart examples, but all were programmed using VB.Net.
When I try to transform it into C#, I failed .

System notified me, it cannot find ChartSpace and any other class of OWC.

below is VB version that works fine.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.Office.Interop

....


'Create a new chartspace:
ChartSpace1 = new Owc.ChartSpace()
'Create a new chart within ChartSpace1:
Chart1 = Chartspace1.Charts.Add(0)
'Add a new dataseries within Chart1:
Chart1_Series1 = Chart1.SeriesCollection.Add(0)
'Define Chart1_Series1 as "scatter" (XY) diagram, with lines and
markers:
Chart1_Series1.Type =
Chartspace1.Constants.chChartTypeScatterLineMarkers
'Name the dataseries (name appears in Legend):
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimSeriesNames,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")
'Populate the X and Y values from array:
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimXValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aX)
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimYValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aY)


If I want to use C#, all the Owc.* class above cannot be found by System.
All the namespace in VB version have been marked "using" in my C# version.

Hope there is someone using C# with OWC.

Thanks. And can anybody tell me why the difference occurs?
 
A

Alvin Bruney [MVP]

you will need to set a reference to the owcX library and use the using
directive to make it available to your code
 
E

Edward

Alvin, thanks for your answer.

Can you make it more clear for me ? If you have time.
you will need to set a reference to the owcX library and use the using
directive to make it available to your code

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Edward said:
Hello, everyone here.

I got several OWC chart examples, but all were programmed using VB.Net.
When I try to transform it into C#, I failed .

System notified me, it cannot find ChartSpace and any other class of OWC.

below is VB version that works fine.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.Office.Interop

...


'Create a new chartspace:
ChartSpace1 = new Owc.ChartSpace()
'Create a new chart within ChartSpace1:
Chart1 = Chartspace1.Charts.Add(0)
'Add a new dataseries within Chart1:
Chart1_Series1 = Chart1.SeriesCollection.Add(0)
'Define Chart1_Series1 as "scatter" (XY) diagram, with lines and
markers:
Chart1_Series1.Type =
Chartspace1.Constants.chChartTypeScatterLineMarkers
'Name the dataseries (name appears in Legend):
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimSeriesNames,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")
'Populate the X and Y values from array:
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimXValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aX)
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimYValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aY)


If I want to use C#, all the Owc.* class above cannot be found by System.
All the namespace in VB version have been marked "using" in my C# version.

Hope there is someone using C# with OWC.

Thanks. And can anybody tell me why the difference occurs?
 
A

Alvin Bruney [MVP]

From your properties pane, right click on references, select add reference.
Find the OWC10.dll on your machine. It should have been installed when you
downloaded the OWC application.
At the top of your application, put a using OWC10. That will make the
namespaces available to your program.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Edward said:
Alvin, thanks for your answer.

Can you make it more clear for me ? If you have time.
you will need to set a reference to the owcX library and use the using
directive to make it available to your code

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Edward said:
Hello, everyone here.

I got several OWC chart examples, but all were programmed using VB.Net.
When I try to transform it into C#, I failed .

System notified me, it cannot find ChartSpace and any other class of OWC.

below is VB version that works fine.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.Office.Interop

...


'Create a new chartspace:
ChartSpace1 = new Owc.ChartSpace()
'Create a new chart within ChartSpace1:
Chart1 = Chartspace1.Charts.Add(0)
'Add a new dataseries within Chart1:
Chart1_Series1 = Chart1.SeriesCollection.Add(0)
'Define Chart1_Series1 as "scatter" (XY) diagram, with lines and
markers:
Chart1_Series1.Type =
Chartspace1.Constants.chChartTypeScatterLineMarkers
'Name the dataseries (name appears in Legend):
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimSeriesNames,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")
'Populate the X and Y values from array:
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimXValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aX)
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimYValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aY)


If I want to use C#, all the Owc.* class above cannot be found by System.
All the namespace in VB version have been marked "using" in my C# version.

Hope there is someone using C# with OWC.

Thanks. And can anybody tell me why the difference occurs?
 
E

Edward

Thanks, Alvin.

And can you tell me, why vb version doesn't need "Import" other namespace ?

From your properties pane, right click on references, select add reference.
Find the OWC10.dll on your machine. It should have been installed when you
downloaded the OWC application.
At the top of your application, put a using OWC10. That will make the
namespaces available to your program.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Edward said:
Alvin, thanks for your answer.

Can you make it more clear for me ? If you have time.
you will need to set a reference to the owcX library and use the using
directive to make it available to your code

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hello, everyone here.

I got several OWC chart examples, but all were programmed using VB.Net.
When I try to transform it into C#, I failed .

System notified me, it cannot find ChartSpace and any other class of OWC.

below is VB version that works fine.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.Office.Interop

...


'Create a new chartspace:
ChartSpace1 = new Owc.ChartSpace()
'Create a new chart within ChartSpace1:
Chart1 = Chartspace1.Charts.Add(0)
'Add a new dataseries within Chart1:
Chart1_Series1 = Chart1.SeriesCollection.Add(0)
'Define Chart1_Series1 as "scatter" (XY) diagram, with lines and
markers:
Chart1_Series1.Type =
Chartspace1.Constants.chChartTypeScatterLineMarkers
'Name the dataseries (name appears in Legend):
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimSeriesNames,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")
'Populate the X and Y values from array:
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimXValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aX)
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimYValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aY)


If I want to use C#, all the Owc.* class above cannot be found by System.
All the namespace in VB version have been marked "using" in my C# version.

Hope there is someone using C# with OWC.

Thanks. And can anybody tell me why the difference occurs?
 
A

Alvin Bruney [MVP]

it does
Imports Microsoft.Office.Interop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Edward said:
Thanks, Alvin.

And can you tell me, why vb version doesn't need "Import" other namespace
?

From your properties pane, right click on references, select add reference.
Find the OWC10.dll on your machine. It should have been installed when
you
downloaded the OWC application.
At the top of your application, put a using OWC10. That will make the
namespaces available to your program.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Edward said:
Alvin, thanks for your answer.

Can you make it more clear for me ? If you have time.

you will need to set a reference to the owcX library and use the using
directive to make it available to your code

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hello, everyone here.

I got several OWC chart examples, but all were programmed using VB.Net.
When I try to transform it into C#, I failed .

System notified me, it cannot find ChartSpace and any other class of
OWC.

below is VB version that works fine.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.Office.Interop

...


'Create a new chartspace:
ChartSpace1 = new Owc.ChartSpace()
'Create a new chart within ChartSpace1:
Chart1 = Chartspace1.Charts.Add(0)
'Add a new dataseries within Chart1:
Chart1_Series1 = Chart1.SeriesCollection.Add(0)
'Define Chart1_Series1 as "scatter" (XY) diagram, with lines and
markers:
Chart1_Series1.Type =
Chartspace1.Constants.chChartTypeScatterLineMarkers
'Name the dataseries (name appears in Legend):
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimSeriesNames,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")
'Populate the X and Y values from array:
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimXValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aX)
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimYValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aY)


If I want to use C#, all the Owc.* class above cannot be found by
System.
All the namespace in VB version have been marked "using" in my C#
version.

Hope there is someone using C# with OWC.

Thanks. And can anybody tell me why the difference occurs?
 
E

Edward

I mean why VB version doesn't need "Import OWC" or "Import OWC10", while C#
version needs it?

"Microsoft.Office.Interop" is in the two version.

I'm now using OWC10.
it does
Imports Microsoft.Office.Interop

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Edward said:
Thanks, Alvin.

And can you tell me, why vb version doesn't need "Import" other namespace
?

From your properties pane, right click on references, select add reference.
Find the OWC10.dll on your machine. It should have been installed when
you
downloaded the OWC application.
At the top of your application, put a using OWC10. That will make the
namespaces available to your program.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Alvin, thanks for your answer.

Can you make it more clear for me ? If you have time.

you will need to set a reference to the owcX library and use the using
directive to make it available to your code

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hello, everyone here.

I got several OWC chart examples, but all were programmed using VB.Net.
When I try to transform it into C#, I failed .

System notified me, it cannot find ChartSpace and any other class of
OWC.

below is VB version that works fine.

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.Office.Interop

...


'Create a new chartspace:
ChartSpace1 = new Owc.ChartSpace()
'Create a new chart within ChartSpace1:
Chart1 = Chartspace1.Charts.Add(0)
'Add a new dataseries within Chart1:
Chart1_Series1 = Chart1.SeriesCollection.Add(0)
'Define Chart1_Series1 as "scatter" (XY) diagram, with lines and
markers:
Chart1_Series1.Type =
Chartspace1.Constants.chChartTypeScatterLineMarkers
'Name the dataseries (name appears in Legend):
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimSeriesNames,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, "Chart1_Series1")
'Populate the X and Y values from array:
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimXValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aX)
Chart1_Series1.SetData (Owc.ChartDimensionsEnum.chDimYValues,
Owc.ChartSpecialDataSourcesEnum.chDataLiteral, aY)


If I want to use C#, all the Owc.* class above cannot be found by
System.
All the namespace in VB version have been marked "using" in my C#
version.

Hope there is someone using C# with OWC.

Thanks. And can anybody tell me why the difference occurs?
 

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