What is the simplest way to write values to textBox1.text in Form1 from other classes in the same application?
Posted on 2003-02-28
I have a c# windows application with several classes. The classes are Form1.cs, MyThreads.cs and ServerSockets.cs. The main form is used to present most of the data to the user via textboxes. The class called 'MyThreads' is instanced in Form1. The MyThreads class spawns a thread that instances the ServerSockets class which does some socket communication.
Everything runs fine except when the 'ServerSockets' class attempts to write to the Form1 textBox1.text property.
I am hoping there is a very simple way to reference this textbox and write values to Form1's textBox from any of the classes in my application. They all share the same namespace but I can not as yet find anything on the net which easily describes how to do this.
In summary, is there an easy way to set focus to Form1 and easily write to textBoxes in Form1 from any of the other classes in the application?
Any help would be much appreciated! :)