Re: A window form call B window form 出現的問題...

看板C_Sharp (C#)作者時間20年前 (2004/10/23 03:01), 編輯推噓2(200)
留言2則, 2人參與, 最新討論串1/1
> 然後在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 )

210.68.184.96 10/23, , 1F
我是宣告成global,不過我找到問題了,thx:)
210.68.184.96 10/23, 1F

140.118.99.188 10/23, , 2F
沒錯沒錯...你有了兩個A類別的物件
140.118.99.188 10/23, 2F
文章代碼(AID): #11ULaE00 (C_Sharp)
文章代碼(AID): #11ULaE00 (C_Sharp)