the detail of my action is i have a winform which contains only progress bar which i made to do some calculations and stored the final value in db.for this i used progress bar and backgroundworker thread. i am doing all calculation in backgroundworker thread event doWork event. When backgroundworker is finish it calls RunWorkerCompleted event, in which i am trying to open another winform. The problem is that winform doesnt get visible.
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) 
{ 
    if (!string.IsNullOrEmpty(click)) { 
        if (click == "sales") { 
           Sales sales = new Sales(); 
           sales.MdiParent = mdiStockApp.mdi; 
           sales.Show(); 
           sales.Activate(); 
        } 
 开发者_开发问答   } 
}
this is the RunWorkerCompleted event in which i am trying to open another event. just now i tried with form.Activate() too but still no
It may be that BackgroundWorker OnWorkCompleted throws cross-thread exception ? Try UI handling in another thread, check this.IsInvokeRequired property and use this.Invoke(...)
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论