473,320 Members | 2,083 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,320 software developers and data experts.

events between threads?

Can the main thread be notified of an event raised by a spawned?
A button on a form creates a new thread which will raise an event when
it is finished. When the form is notified of the thread termination
event, I want my form to create a new form and make the new form's MDI
parent the same as it's MDI parent. Problem is that I get an error
stating that controls created in a thread cannot have their parent set
to a form in another thread. If I don't set the MDI parent of the new
form, it flashes up and then dies as the spawned thread dies.
How can I create the new form when the spawned thread dies, set its
mdi parent, and have it persist after the thread dies? (I don't want
to have code on the main form continuously polling the new thread)

thanks!
Nov 15 '05 #1
1 1172
"Terry" <th******@netscape.net> wrote in message
news:b2**************************@posting.google.c om...
Can the main thread be notified of an event raised by a spawned?
A button on a form creates a new thread which will raise an event when
it is finished. When the form is notified of the thread termination
event, I want my form to create a new form and make the new form's MDI
parent the same as it's MDI parent. Problem is that I get an error
stating that controls created in a thread cannot have their parent set
to a form in another thread. If I don't set the MDI parent of the new
form, it flashes up and then dies as the spawned thread dies.
How can I create the new form when the spawned thread dies, set its
mdi parent, and have it persist after the thread dies? (I don't want
to have code on the main form continuously polling the new thread)


Hi Terry,

You could probably call the Invoke method of your form when the thread is
ready to exit. It sounds like you were having problems because you tried to
call the UI thread with your secondary thread. Here are a few articles with
examples that should help:

http://www.windowsforms.net/Default....d=40#Threading

Joe
--
http://www.csharp-station.com
Nov 15 '05 #2

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

Similar topics

4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
3
by: Stampede | last post by:
Hi, I want to use the FileSystemWatcher in a Windows Service. I read an article, where the author created the FileSystemWatcher object in a seperate thread and when the event is fired, he started...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
15
by: Bryce K. Nielsen | last post by:
I have an object that starts a thread to do a "process". One of the steps inside this thread launches 12 other threads via a Delegate.BeginInvoke to process. After these 12 threads are launched,...
3
by: daan | last post by:
Hello, I have a problem and I can't get the solution for it :( I have a com dll, which i imported as a reference. The com object is part of a class which is multithreaded and will create...
14
by: Gotch | last post by:
Hi all, I've recently digged into C# and the whole .Net stuff. Particularly I found the idea of adding Events and Delegates to the C# language very interesting and I'm trying to use them in...
4
by: jehugaleahsa | last post by:
Hello: Is there a way to prevent one event from firing while another event is already being fired? I have a tool that extracts media from web pages and it has multiple events firing when the...
9
by: thiago777 | last post by:
Question details: VB .NET / threads / events / GUI Imagine the following situation: A method from object "A" creates "n" threads. Variables from these threads contains values that should...
0
by: thiago777 | last post by:
Hi! Im still trying to make my application work in an event-driven way. It had worked so far with my threads, but the problem Im having is only when modifying a GUI component from the event handler...
3
by: JohnM | last post by:
Hi there, Are there any specific rules or best-practices I should be aware regarding events and the threads they're fired on. Object 1 can be created on thread 1 for instance and an event then...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.