Normally, I am working with C on embedded system. I am newbie at OOP and C#. I found 2 solutions Idk they are proper way or not but I hope it solve your problem.
Solution 1:
Go to your WinForm and add the code below to produce a reference to call your Form later
public partial class Form1:Form
{
public static Form1 form;
public Form1()
{
form = this;
InitializeComponent();
}
}
Now, go to your other Form and try this
Form1.form.textBox1.Clear();
Solution 2:
I tried to use call by ref and it worked. If this method not proper, please inform me with reason.
I added new button with click action to Form1.
private void ButtonClear_Click(object sender, EventArgs e)
{
class.TextClear(ref textBox1);
}
And I created new class named "class" and added method below.
public static void TextClear(ref TextBox textBox1)
{
textBox1.Clear();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…