每次在串行端口上输入时启动子程序 [英] Start a subrutine everytime input on Serial Port
本文介绍了每次在串行端口上输入时启动子程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
每次我在串口中输入任何内容时我都会尝试做一些工作,但是出现了一个Exception,指的是使用不当标签,文本框等。
我想知道如何处理这个问题。我猜它类似于后台工作者,但我无法解决问题。
预先感谢您的帮助。
Hi all,
I am trying to do some work everytime I have any input in the serial port, but an Exception appears refering to the bad use of the labels, textboxes, etc.
I want to know how I can handle this. I guess its similar to the background worker but I don't manage to solve the problem.
Thanks in advance for the help.
void PuertoSerieDataReceived(object sender, SerialDataReceivedEventArgs e)
{
Command0() // Some work that access in some parts to the GUI
}
推荐答案
查看文档:如何:对Windows窗体控件进行线程安全调用 [ ^ ]。
这篇关于每次在串行端口上输入时启动子程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文