i am pretty green to c#. can u provide an example or a link on how to
pass reference to the form or textbox.
appreciate ur help
On Oct 31, 1:48 pm, Joe Enos <[EMAIL PROTECTED]> wrote:
> You can't access an instance's textbox from a static method - the
> static method does not even know whether or not an instance of the
> form even exists, let alone which one is calling it.
>
> If you can change your static methods so their not static, that would
> be best - or you can pass the reference to the textbox (or the form
> itself) around as a parameter, then you'll be able to access it.
>
> On Oct 31, 10:42 am, Dickery1 <[EMAIL PROTECTED]> wrote:
>
>
>
> > i have issues in writing to a textbox from static method
> > private static void appendToTextBox(string str){
> > Form1.textBox1.Text += str + "\r\n";
>
> > }
>
> > An object reference is required for the nonstatic field, method, or
> > property 'collectTickData.Form1.textBox1'
>
> > how do i fix it. aparrently all the mehods calling appendToTextBox are
> > static and so i made it static too.
> > appreciate any help.- Hide quoted text -
>
> - Show quoted text -