个人认为第三种比较好
A.设置构造函数参数
//窗体2中的构造函数
public form2(string str) {
   InitializeComponent();
   this.textBox1.Text = str;
}

B.在需要调用的类中设置静态方法并调用
public class form2 : form {
   public static setTextbox1(string str) {
      this.textBox1.text = str;
   }
}
然后在form1中调用该方法进行设置
C.将声明TextBox的时候,权限改成public或者包访问

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
  • 2021-11-08
  • 2022-12-23
相关资源
相似解决方案