C#
1namespace WindowsFormsApplication1 2{ 3 public partial class Form1 : Form 4 { 5 Class1 c = new Class1(); 6 public Form1() 7 { 8 InitializeComponent(); 9 } 10 11 private void button1_Click(object sender, EventArgs e) 12 { 13 c.a(); 14 } 15 } 16 class Class1 17 { 18 public void a() 19 { 20 Form1 f = new Form1(); 21 f.label1.Text = "aaa"; 22 } 23 } 24} 25
Form1をnewしているからクリックしても変わらないのはわかったのですが、どうすればlabel1を変えれますでしょうか?
よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/07/24 06:29
2017/07/24 06:38
退会済みユーザー
2017/07/24 06:50