为了账号安全,请及时绑定邮箱和手机立即绑定

将数据从另一个类传递到表单

将数据从另一个类传递到表单

C#
MMMHUHU 2021-03-30 17:14:58
我想将数据传递给form1另一个类,但是我没有这样做。我试过的是    class other_class {      public a_function() {        Form1 form1 = new form1();        form1.something("Lorem Ipsum");      }   }虽然form1只是 public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();            other_class a = new other_class();            a.a_function();        }        public void something(string str) {            //Pass to Another generic function            another_function(str);        }       public void another_function(string str) {            //Do update Textbox and RichtextBox Fields       } }但是,似乎无法从另一个类调用form1中的函数。最好的解决方法是什么?
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 132 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信