Form refresh - Class comunications

A

alessiob82

Hi,

I'm developing an application that use an OPC client. In this
application I create a class <A> to manage the OPC data (read values
from server every xxx seconds or with subscription, ecc...). In the
application form I put some label, checkbox, ecc.. to show the values
readed from the server and stored in <A>. How can I update
automatically the window object with the values readed? If it is not
possible, which is the better mode to read the data from OPC server and
update the form?

Thank you!
 
J

Jianwei Sun

Hi,

I'm developing an application that use an OPC client. In this
application I create a class <A> to manage the OPC data (read values
from server every xxx seconds or with subscription, ecc...). In the
application form I put some label, checkbox, ecc.. to show the values
readed from the server and stored in <A>. How can I update
automatically the window object with the values readed? If it is not
possible, which is the better mode to read the data from OPC server and
update the form?

Thank you!


you want to create an event inside class A called DataRecieved. And
then, on your windows from, you want to add an event handler to listen
to that event.

Inside your event handler function, you can update the windows form.
Make sure you check, from.InvokeRequired to marshal the call to the
proper thread.

HTH.
John.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top