Hi Nicholas,
Thanks for your reply. I had realized this early and actually tried writing
a public function to perform the actions as you had mentioned.
public void PostToBox(string msg)
{
richTextBox1.AppendText(msg);
}
However, being new to C#, I'm not sure how to call this function from my
other class (in the same namespace). Am I missing a uses statement or
something like that? It seems that I don't have access to the PostToBox
function when I attempted to call it: Form1.PostToBox("hello");
Thanks for your time and patience,
Chris
in message news:
[email protected]...
Chris,
You can set the access modifier of the rich text box to public,
and
then
it will expose that member to anything that is holding a reference to your
form. However, I generally think that this is bad practice, and you should
expose methods on your form that will perform the actions for you.
Something like a SetText method, or something of that nature.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Hi,
I'm trying to append text from another class to a generic
richTextBox
that
I've added to a Windows form. I can't seem to figure out how to expose
the
richTextBox to append text to it.
Thanks in advance,
Chris