A very simple code, but a "type mismatch" error occurred.

TeeChart for ActiveX, COM and ASP
Post Reply
realife
Newbie
Newbie
Posts: 4
Joined: Thu Jul 27, 2023 12:00 am

A very simple code, but a "type mismatch" error occurred.

Post by realife » Sat Jul 29, 2023 5:10 pm

A very simple code, but a "type mismatch" error occurred. Please ask for help from experts!

The code is as follows:

Code: Select all

void Cteechartdemo2Dlg::OnBnClickedLine1()
{
	// TODO: 
	CSeries lineSeries = (CSeries)m_Teechart1.Series(0);
	lineSeries.Clear();
	for (int i = 0; i < 50; i++)
	{
		lineSeries.AddXY((double)i, rand(), NULL, NULL);
	}
}
Image

realife
Newbie
Newbie
Posts: 4
Joined: Thu Jul 27, 2023 12:00 am

Re: A very simple code, but a "type mismatch" error occurred.

Post by realife » Sat Jul 29, 2023 5:58 pm

realife wrote:
Sat Jul 29, 2023 5:10 pm
A very simple code, but a "type mismatch" error occurred. Please ask for help from experts!

The code is as follows:

Code: Select all

void Cteechartdemo2Dlg::OnBnClickedLine1()
{
	// TODO: 
	CSeries lineSeries = (CSeries)m_Teechart1.Series(0);
	lineSeries.Clear();
	for (int i = 0; i < 50; i++)
	{
		lineSeries.AddXY((double)i, rand(), NULL, NULL);
	}
}
Image
After tracking and debugging, it was found that this error (COleException cause. code=80020005) should be resolved?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: A very simple code, but a "type mismatch" error occurred.

Post by Yeray » Mon Jul 31, 2023 10:34 am

Hello,

I'm not sure what exact line of code is giving the error in that screenshot. However, if we assume there is a Line series in the Chart, I think that code should work.
If you still find problems with it, please arrange a simple example project we can run as-is to reproduce the problem here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply