Hello,
Attached is a very simple sample project that reproduces an exception when changing the datasource to "manual" under Series/Datasource in the options dialog.
Extract and open the solution in VS2022. Turn "on" exceptions by ticking on the "Common Language Runtime" in the exceptions docking window. Run it (it uses the latest TeeChart NuGet package) without debugger attached. Click the Options button, go to Series / Datasource and switch the drop-down to Manual.
I've tracked the issue down to the code using DataBindings.Add with a DataGridView instead of just assigning the Datasource property to the DataTable.
Kind Regards,
Kris Culin
Bentley Systems, Inc.
Manual DataSource Causes Exception
Manual DataSource Causes Exception
- Attachments
-
- Image of unhandled exception
- TeeChartUnhandledException.png (23.6 KiB) Viewed 13624 times
-
- TeeChartNET60.zip
- Sample project
- (7.28 KiB) Downloaded 858 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Manual DataSource Causes Exception
Hello Kris,
thank you for the bug report, as is standard procedure we can add these reports directly to our issue tracker, as I have done in this case with id=2615.
thank you for the bug report, as is standard procedure we can add these reports directly to our issue tracker, as I have done in this case with id=2615.
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Manual DataSource Causes Exception
Hello Kris,
this is now fixed, and the diff for you to fix the sourcecode, if you so wish, is this:
this is now fixed, and the diff for you to fix the sourcecode, if you so wish, is this:
Code: Select all
diff --git a/TeeChart.PCL.NET5/TeeChart.WinForm/Editors/Series/SeriesEditor.cs b/TeeChart.PCL.NET5/TeeChart.WinForm/Editors/Series/SeriesEditor.cs
index 225fb07d..a4641a3d 100644
--- a/TeeChart.PCL.NET5/TeeChart.WinForm/Editors/Series/SeriesEditor.cs
+++ b/TeeChart.PCL.NET5/TeeChart.WinForm/Editors/Series/SeriesEditor.cs
@@ -793,7 +793,11 @@ namespace Steema.TeeChart.Editors
if (data.Tables.Count == 1)
{
dataTable = data.Tables[0];
- dataGrid1.DataBindings.Add(dataTable.TableName, data, dataTable.TableName);
+ var binder = new BindingSource
+ {
+ DataSource = dataTable
+ };
+ dataGrid1.DataSource = binder;
dataTable.RowChanged += new System.Data.DataRowChangeEventHandler(dataGrid1_DataSourceChanged);
}
}
@@ -801,7 +805,11 @@ namespace Steema.TeeChart.Editors
{
data = series.GetChartData();
dataTable = data.Tables[0];
- dataGrid1.DataBindings.Add(dataTable.TableName, data, dataTable.TableName);
+ var binder = new BindingSource
+ {
+ DataSource = dataTable
+ };
+ dataGrid1.DataSource = binder;
dataTable.RowChanged += new System.Data.DataRowChangeEventHandler(dataGrid1_DataSourceChanged);
}
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Manual DataSource Causes Exception
Thank you, Christopher, for the quick turnaround. I'll make our change consistent with yours.
Kind Regards,
Kris Culin
Bentley Systems, Inc.
Kind Regards,
Kris Culin
Bentley Systems, Inc.