Home | Downloads | Support | Buy Now | Top Users | Company
 
Instrumentation Pack
 
Components
Visual Graph
AirGauge
AniLine
Annunciator
Gauge
Indicator
Knob
Led
Meter
NumberLed
Odometer
Percent
Selector
Slider
Toggle
Trend

Application
Comport Wizard

Bundled Products
OPCWare
HMITalk
 
 

.NET | ActiveX | VCL
  How to connect Trend .NET component to a database or a data file?
Which version framework are the Instrumentatation Studio for .NET 3.0 based on?
How to connect Trend .Net component to a database or a data file?
The Trend .NET(2.0) do not support directly read data from hard disk file, because we don't know your file format. You can read data by your self and use the cstAddXY or cstAddXYArray method to add the data to the control, but Trend.NET 3.0 provide the module, please see the example.

C#
//Read the last record for x axis and set the value to XMax
......
//Read the first record for x axis and set the value to XMin
......

Trend2.XMax = [last record];
Trend2.XMin = [first record];
Trend2.cstSetXDisplay(Trend2.XMin, Trend2.XMax);

double[,] XY = new double[2,RecordNum-1]; //two dimensions array, 0 dimension is for x value, 1 dimension is for y value

for (i = 0; i <= RecordNum-1; i++)
{
//XValue = ......
XY[0, i] = XValue;
//YValue = ......
XY[1, i] = YValue;
}
Trend2.cstAddXYArray(0, ref XY); //0 is the index of Vars
//that is say, for 1st line(Var 0), the control will link RecordNum-1 XY data points
//if there is more vars,continue to add data
......
Trend2.cstRedrawDynamic();

VB.NET

'Read the last record for x axis and set the value to XMax
......
'Read the first record for x axis and set the value to XMin
......

Trend2.XMax = [last record]
Trend2.XMin = [first record]
Trend2.cstSetXDisplay(Trend2.XMin, Trend2.XMax)

Dim XY(1, RecordNum-1) As Double 'two dimensions array, 0 dimension is for x value, 1 dimension is for y value

For i = 0 To 99
'XValue = ......
XY(0, i) = XValue
'YValue = ......
XY(1, i) = YValue
Next
Trend2.cstAddXYArray(0, XY) '0 is the index of Vars
'that is say, for 1st line(Var 0), the control will link RecordNum-1 XY data points
'if there is more vars,continue to add data
......
Trend2.cstRedrawDynamic()

Back to Top

Which version framework are the Instrumentation Studio for .NET 3.0 based on ?
The Instrumentation Studio for .NET 3.0 are developed by VS.NET 2005, so it need framework 2 or later.

Back to Top
CSTSOFT All rights reserved.