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

Create forms from threads

Hi,

I need to be able to create one or more form(s) from a method that is
called from different threads. When this form is created, it appears but
it does not receive any message. It looks blank, and when you move your
cursor over it, it becomes an hourglass.

Can anyone help me with this?
Thanx in advance...

Kind regards,
Kevin Chabot
Nov 17 '05 #1
2 1260
Kevin,

What you will want to do is call the Invoke method on a control that is
hosted on the main UI thread. This method will take a delegate and an array
of objects (the parameters) and call the target of that delegate in the main
UI thread. You would create a delegate which would point to a method which
creates and shows the form.

You could also run a new message loop through a call to the static Run
method on the Application class in the new thread, but I would advise
against that (it's not common practice, and I don't think the Run method was
meant to be called more than once).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Kevin Chabot" <ke*********@skynet.be> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi,

I need to be able to create one or more form(s) from a method that is
called from different threads. When this form is created, it appears but
it does not receive any message. It looks blank, and when you move your
cursor over it, it becomes an hourglass.

Can anyone help me with this?
Thanx in advance...

Kind regards,
Kevin Chabot

Nov 17 '05 #2
Hi,

Great! Thank you very much.

Kind regards,
Kevin Chabot

Nicholas Paldino [.NET/C# MVP] wrote:
Kevin,

What you will want to do is call the Invoke method on a control that is
hosted on the main UI thread. This method will take a delegate and an array
of objects (the parameters) and call the target of that delegate in the main
UI thread. You would create a delegate which would point to a method which
creates and shows the form.

You could also run a new message loop through a call to the static Run
method on the Application class in the new thread, but I would advise
against that (it's not common practice, and I don't think the Run method was
meant to be called more than once).

Hope this helps.

Nov 17 '05 #3

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

Similar topics

2
by: Rudi | last post by:
Is there anyone who can point me to a good tutorial on how to create a multithreaded class library? Class A is a controller that starts up a number of threads of code in Class B. Class B raises...
4
by: Joey Powell | last post by:
Hello all. For a long time now I have been struggling with a .net Windows Forms problem. In several of my applications, I use the "Process" class from System.Diagnostics to accomplish various task...
6
by: SamIAm | last post by:
Hi am creating a email application that needs to mail out a very large amount of emails. I have created a multithreaded c# application that using message queuing. I have created a threadpool of 5...
2
by: Bill Nguyen | last post by:
How can I create a shared function to display process progress that can be called from other routines within an application? Any example that I can follow? Thanks Bill
4
by: Scott Johnson | last post by:
Hi! Is there a way to "preload" a form using a thread or something else so that my user doesn't have to wait 5 seconds (initializing time) between forms? Some of these forms have tab strips with...
2
by: Chris Dunaway | last post by:
I am attempting to use the AppDomain.UnhandledException event in a Windows Forms app and also in a Windows Service. But the event doesn't seem to be called. In a Windows Forms app, the event IS...
2
by: xmutantduck | last post by:
Hi, I am trying to write a program that can spawn forms when running in an alternate thread outside the main one. It however doesnt like to do anything related to the first thread when in the...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
2
by: anon | last post by:
- realtime application has multiple forms. each form is created on a new (gui) thread. this was supposedly for efficiency reasons, i am told. this was done before i took this project. it was done...
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...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...
0
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...

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.