I have to pass value into RichTextBox from a class. Here is my code. I have to pass values into any tools like textbox, listbox but I don't know how. I have to use delegates to pass md value to both methods and into the same richtextbox.
namespace delegateEx2
{
public class MyClass : Form1
{
delegate void MyDelegate(string MyString);
public void ShowThoseMessages()
{
MyDelegate md = new MyDelegate(log1);
md += log2;
md("Error Log Text");
}
public void log1(string message) {
//what can I write here to pass the md into the RichTextBox on Form1.cs
//I tried something like Systems.Windows.Form.rtxblog but did not work
//......................................
}
public void log2(string message2)
{
//.....................................
}
}
I had to look this up before. Here is some example code...
TheClass.cs
...
Then in my form I have...
The simple questions is to change the modifier in your richtextbox declaration. You can find the declaration in Form1.designer.cs. Change the modifier from private to protected, then you can access the richtextbox from log1 method.