Hi guys..
I have some problem with Richtextbox. I have a Richtextbox in Form class. How can I add any text into the textbox from other classes for instance from Client class? Hope you can help me.

Thanks

DO:

//on main form:
void OpenClient()
{
    Client c = new Client(this);
    c.DoWork();
}

public void AddText(string text)
{
    this.richTextBox1.AppendText(text+Environment.NewLine);
}

//on client class:
class Client
{
    MainForm mf;
    public Client(MainForm _mf)
    {
        this.mf = _mf;
    }

    public DoWork()
    {
        string text = "";
        //do some work ... and add value to text field;
        //and pass to rtb on main form:
        mf.AddText(text);
    }
}

thank you mitja...very helpfull:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.