1
Open Discussion / C# Subscribe
« on: July 10, 2017, 10:48:55 AM »
Hi
Can anyone tell me what I am doing wrong with my C# subscribe/callback here. I get the message back with a value of 1 for the subID but the call back never fires.
private void btnStart_Click(object sender, EventArgs e)
{
try
{
subID = testplc.Subscribe("dateTime[0]", 6, t, the_callback);
testplc.PollRateOverride = 1000;
}
catch (Exception ex)
{
MessageBox.Show(Convert.ToString(ex));
}
MessageBox.Show("Subscription " + Convert.ToString(subID) + " is subscribed" ,"Subscription ID");
}
private void the_callback(object sender, MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs e)
{
txtOutput.Text = e.Values[0];
label1.Text = "Connected";
}
Can anyone tell me what I am doing wrong with my C# subscribe/callback here. I get the message back with a value of 1 for the subID but the call back never fires.
private void btnStart_Click(object sender, EventArgs e)
{
try
{
subID = testplc.Subscribe("dateTime[0]", 6, t, the_callback);
testplc.PollRateOverride = 1000;
}
catch (Exception ex)
{
MessageBox.Show(Convert.ToString(ex));
}
MessageBox.Show("Subscription " + Convert.ToString(subID) + " is subscribed" ,"Subscription ID");
}
private void the_callback(object sender, MfgControl.AdvancedHMI.Drivers.Common.PlcComEventArgs e)
{
txtOutput.Text = e.Values[0];
label1.Text = "Connected";
}