I have windows application in C# and have a richtextbox in the GUI. I want to reach the richtextbox and append some text to it from inside a class. I thought about creating a static RichTextBox item in the form's code file and then call it like this:
public partial class Form1 : Form
{
public static RichTextBox box;
public Form1()
{
box = richtextbox_in_gui;
}
}
public class SomeClass()
{
Form1.box.AppendText("...");
}
Is that a safe way to do it? Or is there any other way i can do this?
Thanks