// This KEPServerEX example shows how to read and display value of a single item.
//
// Find all latest examples here: https://www.doc-that.com/files/onlinedocs/OPCLabs-ConnectivityStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-ConnectivityStudio-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://forum.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.
using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;
namespace DocExamples.Specialized
{
partial class Kepware_KEPServerEX
{
public static void ReadItemValue()
{
// Instantiate the client object.
var client = new EasyDAClient();
Console.WriteLine("Reading item value...");
object value;
try
{
value = client.ReadItemValue("", "Kepware.KEPServerEX.V6", "Simulation Examples.Functions.Ramp1");
}
catch (OpcException opcException)
{
Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
return;
}
Console.WriteLine(value);
}
}
}