交叉线程问题? [英] Cross threading issues ?
问题描述
大家好,
我试图给代表打电话用数据更新我的表格。这是我第一次和代表们愚弄,所以我觉得我需要一点手握。我似乎已经正确设置了所有内容它只是通过两个线程调用代表
我现在已经获得了这一行
Hi All,
I am trying to call a delegate to update my form with data. This is my first time fooling with delegates so I think I need a touch of hand-holding. I appear to have set up everything correctly it is just the calling the delegate over two threads
I have at the moment got the line
//myForm1.AccessFormMarshalDelegate1(InputData);
// myForm1.AccessFormMarshall(InputData);
哪个没有工作(因此注释)我需要使用一个Invoke命令,所以我可以安全地交叉线程,我在读取端口与数据的端口后直接进行此操作。我希望以下内容能够正常工作
which do not work (hence the comments) I need to use an Invoke command so I can cross thread in safety, I am tring to this straight after I read the port the port with the data on. I was hoping that the following would work
myForm1.Invoke(AccessFormMarshall(InputData));
但是没有人能够看到为什么数据会到达串口而不会在表格上显示?
格伦
but it does not can anyone see why data would arrive at the serial port and not be displayed on the form otherwise?
Glenn
推荐答案
为什么不跟着文档 [ ^ ]食谱?
Why don''t you follow the documentation[^] recipe?
这篇关于交叉线程问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!