主程序调用线程弹出进度条的模态对话框
运行错误;未讲对象引用设置到类的实例     
模态对话框类
   public delegate void SetPos(int pos, string info);
      
        public void SetPBarMessage(int pos, string info)
        {
            if (this.InvokeRequired)
            {
                SetPos setPos = new SetPos(SetPBarMessage);
                this.Invoke(setPos, new object[] { pos, info });
            }
            else
            {
              lbAInfo.Text = info;
              progressBar.Value = pos;
            }主线程
Thread PBarThread = new Thread(new ThreadStart(PBarThreadFun));//开辟一个新的线程 
            PBarThread.Start();
  private void PBarThreadFun()
        {
            pBarFrm = new FrmPBar();
            pBarFrm.ShowDialog();
            
        }
        private void SetPos(int pos, string info)
        {
            pBarFrm.SetPBarMessage(pos, info);
        }
在需要更新进度条时用 pBarFrm.SetPBarMessage(10, "12");