肥龍 發表於 2008-12-29 16:30:57

C#中怎樣在兩個Form之間傳遞資料


public class Form1 : System.Windows.Forms.Form//兩個表單之1
{

static string OPC;//靜態變數用來保存

public string xx

{

set{OPC=value;}


get{return OPC;}

}
}
public class Form2 : System.Windows.Forms.Form//兩個表單之2
{

Form1 form1=new Form1();

form1.xx=要傳遞的值;
}
//這個時候當執行了Form2後,Form2的值就保存在Form1中的OPC裡。
頁: [1]
查看完整版本: C#中怎樣在兩個Form之間傳遞資料