Page 1 of 1
TeePreviewer InvalidCastExpectation
Posted: Fri Mar 25, 2011 12:58 am
by 16657820
Why am I geting this error when running this code (Using Pro ActiveX 2010.0.0.3 )
Error : "Unable to cast object of type 'AxTeeChart.AxTChart' to type 'TeeChart.TChart'."
With TeePreviewer1
.Chart = TChart1
.PreviewTitle = "My Custom Title"
.ShowPreview()
End With
Regards
Tom
Re: TeePreviewer InvalidCastExpectation
Posted: Fri Mar 25, 2011 2:29 pm
by 10050769
Hello Tom,
I couldn't reproduce your problem here with last version of TeeChartActivex. Can you please, send us a simple project because we can reproduce exactly your here?
Thanks,
Re: TeePreviewer InvalidCastExpectation
Posted: Fri Mar 25, 2011 11:54 pm
by 16657820
Hi,
Attached is a small project file as requested. I look forward to your resolution asap, this issue is very frustrating to say the least.
OS: Windows 7 Professional
Processor: Intel Core(TM)2 Quad CPU Q8200 @2.33GHz
Visual Studio 2010 Sp1 (VB.NET)
Installed TeeCharts:
TeeChart Version 7.0.1.4
TeeChart Version 8.0.0.5
TeeChart Pro v2010.0.0.3.11109 Win32
Regards,
Tom
Re: TeePreviewer InvalidCastExpectation
Posted: Mon Mar 28, 2011 2:39 pm
by 10050769
Hello Tom,
Thanks for your project. I could reproduce your problem and I found that Previewer and Chart aren't linked correctly:
Code: Select all
With AxTeePreviewer1
.Chart = AxTChart1
.........
To link the Previewer with chart you need use ChartLink so do in next lines of code:
Code: Select all
With AxTeePreviewer1
.ChartLink = AxTChart1.ChartLink
.......
Could you modify your code and check if it solve your problem?
I hope will helps.
Thanks,
Re: TeePreviewer InvalidCastExpectation
Posted: Mon Mar 28, 2011 11:45 pm
by 16657820
Hi Sandra,
Thank you for your quick response, the code now works.
By the way, the code I sent you was from your forum site.
Thanks again
Tom
Re: TeePreviewer InvalidCastExpectation
Posted: Tue Mar 29, 2011 9:35 am
by 10050769
Hello Tom,
I am glad that your problem is solved. About of initially code you were using, I inform you that it is made in Visual Basic 6.0 so it doesn't work if you use Visual Studio where you need use ChartLink.
Thanks,