?
Solved

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
4
Medium Priority
?
252 Views
Last Modified: 2010-04-15
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!  :)
0
Comment
Question by:csharpnut
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
man068 earned 152 total points
ID: 8046039
If you are spawning a thread in the background and then using the results to update the form elements is using methodInvokes on the main thread, ie., UI thread. I dont think there is any direct easy way of doing this.

thanks
0
 
LVL 48

Assisted Solution

by:AlexFM
AlexFM earned 148 total points
ID: 8050924
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question