看板 C_Sharp 關於我們 聯絡資訊
原po以前寫vb.net最近改寫c#.net 撰寫vb的函式 不管是function or subroutine可以直接帶入控制項 ex: function aa() textbox1.text = "hello" end function 上述方法到c#內會找不到控制項textbox1,變成要改由參數傳入 ex: void function(ref textbox tb) { tb.text = "hello"; //textbox1.text = "hello"; <---無效 } 這是c#規定的嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 221.120.70.38
ashram:可以啊 10/25 16:38
rex1224:你是寫在獨立的.cs裡面嗎@@? 10/25 17:55
sohumi:我知道原因了, 白目多加了static 變成靜態方法了 10/25 18:28