Open new form in C# thread

method one:

MethodInvoker MethInvk = new MethodInvoker(ShowForm5);
BeginInvoke(MethInvk);  


private void ShowForm5()
{
    Form5 form5 = new Form5();
    form5.Show();
}
This delegate method cannot take parameters



Method 2: Delegate method with parameters

ShowFormHandler delShowForm = new ShowFormHandler(ShowForm5);
this.BeginInvoke(delShowForm, new Object[] { stripaddr, type });

 public delegate void ShowFormHandler(string stripaddr, int type );
 private void ShowForm5(string stripaddr, int type )
 {
     Form5 form5 = new Form5( stripaddr, type );
     form5.Show();
 }


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324109120&siteId=291194637