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