473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing data between two forms in different threads

Hi,

Having a slight problem with how to pass parameters to functions between
threads.

I have a form with a progress bar and a description label on it. It has a
public function
IncrementProgressBar() that just calls performstep on the progress bar.
On my main form I create a thread which creates the progress bar form

Then using

MethodInvoker mi = new MethodInvoker(m_ProgressBar.IncrementProgressBar);

this.BeginInvoke(mi);

I can get this function called wherever is appropriate.

All is fine. But I want a function that takes a string as a parameter so I
can dynamically update the description.

Any idea how to do this? I've searched google and found nothing so far.

I've tried

MethodInvoker mi = new MethodInvoker(m_ProgressBar.UpdateDescription);

object[] args = {m_txtUpdateDescription.Text};

this.BeginInvoke(m_ProgressBar.UpdateDescription, args);

but the first line doesn't compile.

Actually it gives a compiler error (which I'm assuming from other messages
I've seen on google is a bug in the compiler).

Any idea how to get the delegate to wotk with parameters?
Rollasoc



Jul 21 '05 #1
2 2329
Hi Rollasoc,

Check out the following article:
http://msdn.microsoft.com/library/de...ms08162002.asp

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"rollasoc" <ho*****@hotmail.com> wrote in message
news:eK**************@tk2msftngp13.phx.gbl...
Hi,

Having a slight problem with how to pass parameters to functions between
threads.

Jul 21 '05 #2
Cheers for that, It was exactly what I was looking for.

Rollasoc

"Miha Markic" <miha at rthand com> wrote in message
news:eG**************@tk2msftngp13.phx.gbl...
Hi Rollasoc,

Check out the following article:
http://msdn.microsoft.com/library/de...us/dnforms/htm
l/winforms08162002.asp
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"rollasoc" <ho*****@hotmail.com> wrote in message
news:eK**************@tk2msftngp13.phx.gbl...
Hi,

Having a slight problem with how to pass parameters to functions between
threads.


Jul 21 '05 #3

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

Similar topics

2
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text,...
3
by: Curious | last post by:
Hi, I need some technique to communicate by passing messages with different threads. For my problem shared memory is not applicable. Can someone give me some help of what there is available...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
5
by: Rod | last post by:
I've written 2 ASP.NET applications (I've worked on one with a team and another by myself). In my ASP.NET pages, when saving data to a backend database I've done it by using the click event of a...
10
by: Doug Bell | last post by:
Hi, I have an application that has a "Data Access Class" and "User Interface Class". It is for receiving Purchase Order data from one system and pushing processed transactions to another...
10
by: Mark Denardo | last post by:
Hi, I have multi-threaded application that requires one particular thread (Non-Form based) to receive data from other threads. I know how to pass control to Form Threads, but I believe there's no...
2
by: rollasoc | last post by:
Hi, Having a slight problem with how to pass parameters to functions between threads. I have a form with a progress bar and a description label on it. It has a public function...
2
by: Carl Heller | last post by:
Working in VS2003, .Net 1.1 I'm working on a project where I compare data between two databases. This is a lengthy process, and very data intensive, so I decided to create a class, and thread...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.