473,659 Members | 2,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WorkerThreads updating WindowsForm field.

Firstly my main method is like this:

static void Main(string[] args)
{
// New Form Thread
FormHandler myFormHandler = new FormHandler();
ThreadStart myThreadStart = new ThreadStart(myF ormHandler.Show Form);
Thread formWorkerThrea d = new Thread(myThread Start);
formWorkerThrea d.Start();

// Main Thread Handler
MainThreadHandl er threadHandler = new MainThreadHandl er();
}

This opens an instance of a form that I use as a main interface with a
notify icon. it then makes a new instance of MainThreadHandl er causing my
thread handles to start. This is a TCP listener. It creates a new worker
thred for every incoming connection (server). I would like each server
thread created to update or cause the updating of a field in the main Form.
In effect I would like a field on the main form that tells me how manny
connections I have currently open.
Any one know how I can do this?
Nov 15 '05 #1
1 1401
Hi Joshua,

I guess you will need to pass to the MainThreadHandl er
either the FormHandler instance or an object that holds a reference to
the form that you would like to update.

MainThreadHandl er threadHandler = new MainThreadHandl er(myFormHandle r);

Then, MainThreadHandl er's listener thread would do something like the
following to update the form:

_myFormHandler. MyUpdateFormMet hod();

The FormHandler.MyU pdateFormMethod () method updates the form.

Also, since you are updating the form's controls from another thread,
make sure you use Control.Invoke( ) in the method that updates the
form. (MyUpdateFormMe thod in the above example)

Regards,
Aravind C
"Joshua Russell" <jo**@ojmyster. uk.eu.org> wrote in message
news:eb******** ******@TK2MSFTN GP10.phx.gbl...
Firstly my main method is like this:

static void Main(string[] args)
{
// New Form Thread
FormHandler myFormHandler = new FormHandler();
ThreadStart myThreadStart = new ThreadStart(myF ormHandler.Show Form);
Thread formWorkerThrea d = new Thread(myThread Start);
formWorkerThrea d.Start();

// Main Thread Handler
MainThreadHandl er threadHandler = new MainThreadHandl er();
}

This opens an instance of a form that I use as a main interface with a
notify icon. it then makes a new instance of MainThreadHandl er causing my
thread handles to start. This is a TCP listener. It creates a new worker
thred for every incoming connection (server). I would like each server
thread created to update or cause the updating of a field in the main Form. In effect I would like a field on the main form that tells me how manny
connections I have currently open.
Any one know how I can do this?

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
16158
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? 1) simply UPDATING the values for all fields in the table, whether or not any particular field has actually changed 2) running a second SELECT statement and comparing the $_POST vars to the returned values, and only UPDATING those that have...
9
4203
by: Bill Salling | last post by:
am trying to updated the source data(Access2000) for my data grid. But keep getting this error An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dl Additional information: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information I can get the error message to disapper by using the AcceptChanges action to the dataset, but...
1
1598
by: Raul Cortes | last post by:
Hi. I am using a windowsform datagrid to modify a table. The DataSet seems to be filled fined. The DataTable seems to be ok. I am not using 'read only' anywhere. The DataSource seems to be well asigned. The DataMenber assigned to the table. One column of the DataSet is decimal type.
11
3596
by: Liber | last post by:
¿Alguien podría explicarme como enviar mails desde un WindowsForm ?, puedo hacerlo con un WebForm, pero no se como hacerlo con WindowsForm, podrían darme un ejemplo. Gracias, Saludos, Liber.
5
2026
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
7
2222
by: Gary Paris | last post by:
I have a bound datagrid on my windowsform. I have the following declarations in the global module of the project: Public eDS As DataSet Public eDA As OleDb.OleDbDataAdapter In the Load routine of the form, I have the following code Dim eDS As New DataSet
4
2370
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has two fields: a primary key and another holding a string. In table B there are three fields: a primary key, a foreign key (which links to the primary key in A) and other field holding a string.
2
3309
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the CurrentChanged event of the BindingSource of the combobox to update the textbox. When selecting an item in the combobox or when selecting a row in the grid, it is updating the textbox correctly. The problem is when I apply a filter in the grid, and then...
0
2490
by: Mike | last post by:
So here's the situation (.NET 2.0 btw): I have a form, and on this form is a textbox among many other databound controls. The textbox is bound to a field in a data table via the Text property. In this table there are multiple columns that cannot be NULL, which, are bound to other controls (but they're not really important at this time). I create a new row via the currency manager like so: _currencyManager.AddNew() _currentRow =...
0
8427
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8746
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2750
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.