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

我想将数据传递给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中的函数。最好的解决方法是什么?


MMMHUHU
浏览 133回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP