[問題] testBox的一個問題

看板C_Sharp作者 (小丸)時間16年前 (2010/01/10 01:02), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/4 (看更多)
我寫了一個程式有十個button每個button點下去後都會出現一個亂數, 然後那個亂數值會傳到一個textBox中, 目前我是做了一個textBox1,所以button的值都會跑到textBox1中, 可是我想要做兩個textBox, 讓第一個亂數值傳到textBox1中,第二個亂數值跑到textBox2中, 要怎麼解決呢?? private void button1_Click(object sender, EventArgs e) { Random rs = new Random(); int a = rs.Next(6); // int 0-6亂數 button1.Text = a.ToString(); textBox1.text += button1.Text; } private void button2_Click(object sender, EventArgs e) { Random rs = new Random(); int a = rs.Next(6); // int 0-6亂數 button2.Text = a.ToString(); textBox1.Text += button2.Text; } private void button3_Click(object sender, EventArgs e) { Random rs = new Random(); int a = rs.Next(6); // int 0-6亂數 button3.Text = a.ToString(); textBox1.Text += button3.Text; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.112.0.244

01/10 08:30, , 1F
"test"box @@?
01/10 08:30, 1F
文章代碼(AID): #1BIBQBwX (C_Sharp)
文章代碼(AID): #1BIBQBwX (C_Sharp)