TeeChart for ActiveX, COM and ASP
-
realife
- Newbie

- Posts: 4
- Joined: Thu Jul 27, 2023 12:00 am
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);
}
}

-
realife
- Newbie

- Posts: 4
- Joined: Thu Jul 27, 2023 12:00 am
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);
}
}
After tracking and debugging, it was found that this error (COleException cause. code=80020005) should be resolved?
-
Yeray
- Site Admin

- Posts: 9645
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
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.