标题:小白请教大内高手如何将线程里的数组显示在控件上。代码贴上
取消只看楼主
shi521min
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2013-10-8
结帖率:80%
已结贴  问题点数:20 回复次数:1 
小白请教大内高手如何将线程里的数组显示在控件上。代码贴上
  private void backgroundWorker1_DoWork_1(object sender, DoWorkEventArgs e)            
         {
             UInt16[] RegisterValue1 = new UInt16[0];
             UInt16[] RegisterValue2 = new UInt16[0];
             int[] name = new int[2];
             BackgroundWorker worker = sender as BackgroundWorker;
             while (worker.CancellationPending == false)           
             {
                 RegisterValue1 = Master.ReadHoldingRegisters(1, 4096, 1);
                 RegisterValue2 = Master.ReadHoldingRegisters(1, 4102, 1);
                  n = Convert.ToInt16(RegisterValue1[0]);
                  nn = Convert.ToInt16(RegisterValue2[0]);
                  name[1] = (ushort)n;
                  name[2] = (ushort)nn;
                // worker.ReportProgress(0, n);                 
                 Thread.Sleep(1);
             }   
         }
搜索更多相关主题的帖子: 大内高手 private false 如何 
2015-05-26 11:37
shi521min
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2013-10-8
得分:0 
谢谢版主,已经解决问题了!!!
2015-05-27 18:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-445788-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013919 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved