ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  frmrealtimedemo in VB.Net
Posted by Luiz on Dec-14-2021 12:29
Attachments:
Hi!

I'm having a System.NullReferenceException with xxx while triyng to run the frmrealtimedemo in VB.Net.

Could you tell me why is it occurring?

Thanks

Luiz.
Capturar.JPG

  Re: frmrealtimedemo in VB.Net
Posted by Peter Kwan on Dec-14-2021 19:58
Attachments:
Hi Luiz,

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.

Regards
Peter Kwan
devenv_20211214164010.png

  Re: frmrealtimedemo in VB.Net
Posted by Luiz on Dec-15-2021 02:59
Hi Peter!

I'm new in VB.Net and maybe I'm not able to separate the frmrealtimedemo.sln from NetWinCharts.sln.

Could you please show me, step by step, the bether way to separate an item from the NetWinCharts.sln set?

Tanks

Luiz

  Re: frmrealtimedemo in VB.Net
Posted by Peter Kwan on Dec-16-2021 18:31
Hi Luiz,

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.

Regards
Peter Kwan

  Re: frmrealtimedemo in VB.Net
Posted by Peter Kwan on Dec-17-2021 03:44
Hi Luiz,

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.

Regards
Peter Kwan

  Re: frmrealtimedemo in VB.Net
Posted by Luiz on Dec-17-2021 11:06
Hi Peter!

Your last tip worked like a charm.


Thank you so much for all your help.

Luiz