Как зафиксировать цикл одним нажатием кнопки и завершить цикл нажатием другой кнопки в C# Windows Forms?C#

Место общения программистов C#
Anonymous
Как зафиксировать цикл одним нажатием кнопки и завершить цикл нажатием другой кнопки в C# Windows Forms?

Сообщение Anonymous »


I want to have a process run continuously starting when one button (button A) is pressed until another button (button B) is pressed in a C# windows forms application, but I am unable to find a good way to do so.

The idea is to create a program that will access various data tags on an OPC UA server and read the data from those tags continuously as a sort of monitoring system. Since I have functions built in to swap the server's URL and the tags to monitor from the application, I need the monitoring loop to be able to be turned on with a button press and off with a separate a button press.

Does anyone have any good suggestions?

I've tried creating a clock and an event handler to trigger a function when the clock reached the designated time count, but I was unable to get the event handler to run continuously (ironically).


Источник: https://stackoverflow.com/questions/780 ... nother-but

Вернуться в «C#»