473,378 Members | 1,498 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,378 software developers and data experts.

losing args sent using BeginInvoke

I was recently referred to the following articles which I
found very useful:

Safe, Simple Multithread in Windows Forms
http://tinyurl.com/29sd [MSDN]

Second Look at Multithreading in Windows Forms
http://tinyurl.com/k480 [MSDN]
-----Original Message-----
I start a thread from a Windows.Forms.Form which is supposed to use BeginInvoketo safely update a text field on the form by calling UpdateUI.
UpdateUI gets called, but I don't seem to be able to get anything from theSystem.EventArgs I passed in.

I'm using a very simple example from MSDN:
http://msdn.microsoft.com/msdnmag/is...02/Multithread ing/default.aspx
but it just doesn't seem to work.

What am I doing wrong?

private void StartOperations() {
statusTxt.Text = "StartOperations";
Thread pdcThread = new Thread(new ThreadStart( RunningInThread )); pdcThread.Start();

}
private void RunningInThread () {
BeginInvoke(new System.EventHandler(UpdateUI), new object[] { this, newMyProgressEvents("Pdc shutdown issued") });
}
private void UpdateUI(object o, System.EventArgs e) {
MyProgressEvents pe = (MyProgressEvents) e;
statusTxt.Text = pe.msg;
}
public class MyProgressEvents : System.EventArgs {
public string msg = "";

public MyProgressEvents(string s) {
msg = s;
}

}

Thanks, Les Caudle
--
Thanks in advance, Les Caudle
.

Nov 15 '05 #1
0 1464

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

Similar topics

15
by: Stefan Behnel | last post by:
Hi! I'm trying to do this in Py2.4b1: ------------------------------- import logging values = {'test':'bla'} logging.log(logging.FATAL, 'Test is %(test)s', values)...
0
by: mbosco51 | last post by:
I know this is a common thread, but I seem to be losing session variables on my website. I read through everything I could find, including this link: http://aspfaq.com/show.asp?id=2157, but cannot...
32
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being...
12
by: VM | last post by:
Hi, In my Win app, I'm using delegates because the process that'll be running is time-consuming and it requires parameters. The only problem I'm having is that the lines following the BeginInvoke...
11
by: Doug Thews | last post by:
I've been working on some samples that use BeginInvoke/EndInvoke. In one example, I call BeginInvoke and pass it an AsyncCallback function pointer. I was messing around with ReaderWriterLocks and...
2
by: Frank Bishop | last post by:
Can someone tell me why I'm losing my session variable when using Response.Redirect? When I use the RedirectFromLoginPage method(currently remmed out below), my session variable works fine, but I'm...
7
by: DaTurk | last post by:
Hi, I'm trying to send a large number of messages to a UDP multicast group with which I have one client subscribed. But I'm losing mesages, and I'm not entirely sure why. I can't seem to find...
7
by: 7stud | last post by:
Hi, I can't find any documentation for the * operator when applied in front of a name. Is it a pointer? What about the @ operator? Are there python names for these operators that would...
3
by: joelkeepup | last post by:
Hi, im trying to create a text email message using xslt template , the transforms work great, but the newlines and whitespace in the xslt doc are removed. Is there a setting somewhere I have...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.