看板C_Sharp
标 题Re: A window form call B window form 出现的问题...
发信站元智大学风之塔 (Sat Oct 23 02:52:32 2004)
转信站ptt!ctu-reader!ctu-peer!news.nctu!nctumenews!news.ind.ntou!news.ntu!ne
> 然後在FormB里面用下面这段来设定2个textbox的初始值,
> private void FormB_Load(object sender, System.EventArgs e)
> {
> FormA FormA = new FormA();
> textBoxA.text = FormA.W.ToString();
> textBoxB.text = FormA.H.ToString();
> }
> 用下面这段来把textbox的值代回FormA的W, H.
> private void button1_click(object sender, System.EventArgs e)
> {
> FormA FormA = new FormA();
> FormA.W = Convert.ToInt32(textBoxA.text);
> FormA.H = Convert.ToInt32(textBoxB.text);
> }
> 在使用的时候,
如果上面那个是你完整的code的话,那你的FormA并不是同一个,了解吗 ?
(因为你new了两次 :D)
--
※ Origin: 元智大学 风之塔 <bbs.yzu.edu.tw>
※ From : 220-134-24-246.hinet-ip.hinet.net
※ X-Info: Re: A window form call B window form 出现的问题...
※ X-Sign: 10NILNG1qQubXXSxd.vk (04/10/23 2:52:32 )
1F:推 ithinkurdumb:我是宣告成global,不过我找到问题了,thx:) 210.68.184.96 10/23
2F:推 liunate:没错没错...你有了两个A类别的物件 140.118.99.188 10/23