Have you modified the sample code (including modifying the Form in designer)?
One possibility is that the dataSetTimer becomes null because it is removed from the Form, or the it is removed from the frmrealtimedemo.Designer.vb. (The frmrealtimeDemo.Designer.vb is automatically generated by the Windows Forms designer. This file should not be modified manually.)
I have attached a screenshot for your reference. You can see there is a dataSetTimer control in the designer Window. Visual Studio should automatically include code in fromrealtimeDemo.Designer.vb that initialize the dataSetTimer variable.
If the above still cannot solve the problem, please download the ChartDirector for .NET again, and unzip it in a new folder, and then try the sample code without any modification (just open the Visual Studio solution and press the "Run" button), and check if the Real Time Demo sample code is working or not.
The NetWinChart is the Visual Studio sample code for Windows Forms for the .NET Framework.
If you are new to the VB.NET, note that there are two .NET programming systems:
- The ".NET Framework" is the mature and stable system. Its latest version is .NET Framework 4.8.
- The ".NET Core" is originally only for web applications. Recently, it is extended to support Windows Forms.
In my Visual Studio, the "Windows Forms for ".NET Core/.NET 5/.NET 6" is simply called "Windows Forms App", and the "Windows Forms for the .NET Framework" is called "Windows Forms App (.NET Framework)".
To use the sample code in NetWinChart, when you create your project, please make sure you select "Windows Forms App (.NET Framework)". Currently for "Windows Forms for .NET Core/.NET 5/.NET 6", we only include C# sample code. If you want to use VB in "Windows Forms for .NET Core/.NET 5/.NET 6", you may have to modify the sample code to fit your project type.
I have just tried to copy the VB.NET sample code in NetWinChart to a Windows Forms for .NET Core project, and it works too. Basically, I created a new Windows Forms App, and then add a reference to ChartDirector. This is by right clicked on the "Dependencies" folder, choose "Manage nuget package" and the browse and add the ChartDirector.Net.Desktop.Controls package.
I can then copy the frmrealtimedemo.* files to the Windows Forms App folder, add them to the project, and configure the FrmRealTimeDemo as the startup Form (in Project/Properties). Then I pressed the "Run" button, and the demo ran normally.