this.BeginInvoke(new System.Threading.ThreadStart(delegate()
                                    {
                                        lblCount.Text = count.ToString();
                                    }));
调试到这里看到的错误提示:不能进入  lblCount.Text = count.ToString();

解决方案 »

  1.   

    线程里不能更新UI,得用委托参考:
    How to update the GUI from another thread in C#?
    http://stackoverflow.com/questions/661561/how-to-update-the-gui-from-another-thread-in-c
      

  2.   

    你在Timer里开了个线程,专门用于更新UI?有点奇怪,直接更新不行吗?
      

  3.   

    已经解决了,原因是定时导致界面卡死。
    将定时调用放到线程中就好了,修改代码如下:
    private void btnIPCrawl_Click(object sender, EventArgs e)
            {
                Thread thread = new Thread(TimerCrawlIP);
                thread.IsBackground = true;
                thread.Start();
            }        /// <summary>
            /// 定时抓取IP
            /// </summary>
            private void TimerCrawlIP()
            {
                //隔段时间自动调用程序
                System.Threading.Timer threadTimer = new System.Threading.Timer(new System.Threading.TimerCallback(InvokeIPCrawl), null, 0, 14400000);
                while (true)
                {
                    Thread.Sleep(14400000);
                }
            }