How do I programmatically get realtime and historical trend data?
Use the GetTrendDataTable method to return a DataTable object with all trend values.
DataTable myDataTable; myDataTable = opcTrendControl1.GetTrendDataTable();
The following code can be used to programmatically get history data and return the data to a DataTable.
private void button1_Click(object sender, EventArgs e) { DateTime endTime = DateTime.Now; DateTime startTime = endTime.AddMinutes(-20); opcTrendControl1.HistorySelect(startTime, endTime); } private void opcTrendControl1_HistoryDataArrived() { DataTable myDataTable; myDataTable = opcTrendControl1.GetTrendDataTable(); dataGridView1.DataSource = myDataTable; }<< View All FAQs
<< View All Troubleshooting Topics