Newbie Question - how to access a winforms text box from outside the Class?
Posted on 2006-11-13
I have a form with a text box -
wanted to write some messages to it from an outside class.
got an error stating that i could not do that from my external class, becuase 'it does not exist in that context'
fair enough, so I added a public function to the form1 class (my form is called form1)
that looks like this:
public void settext(string thetext)
textBox1.Text += thetext;
Now in my external class, I'm trying to call that function, but I need help with the syntax, as I'm doing something wrong:
public class jacklogger : WatiN.Core.Interfaces.ILogWriter
public void LogAction(string message)
Form1.settext( message + "\r\n");
this gives me the error:
"An Object reference is required for the nonstatic field, method, or property WindowsApplication1.Form1.setttext(string)"
What am I doing wrong?