Your probably looking at doing Asynchronous Pages or Custo
Threading...Async pages use threads already created in the Thread poo
and you don't have to worry about them, System.Threading, you creat
your own thread and what that thread processes....
http://www.developerfusion.co.uk/show/4134/
http://tinyurl.com/durdr
if you google or yahoo search for "asp.net asynchronous" or "asp.ne
threading", you will come up with some good sources....
I am working on a project that implements Asynchronou
Callbacks...easy, and works like a champ (minus some gottchas that I a
still working on)...
I have done both...and they work pretty well, to give the UI back t
your end user....(smoke and mirrors, but hey...the end user doesn'
complain)... :rolleyes
--
rvira
Bob Powell [MVP] - 29 Sep 2005 20:39 GMT
This is a Windows Forms group. The OP needs info on winforms threading
methinks.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
> Your probably looking at doing Asynchronous Pages or Custom
> Threading...Async pages use threads already created in the Thread pool
[quoted text clipped - 14 lines]
> your end user....(smoke and mirrors, but hey...the end user doesn't
> complain)... :rolleyes:
rviray - 29 Sep 2005 22:02 GMT
DURRR...my bad :o
Don't know what I was thinking of....
'Bob Powell [MVP Wrote:
> ']This is a Windows Forms group. The OP needs info on winform
> threading
[quoted text clipped - 41 lines]
>
> ------------------------------------------------------------------------
--
rvira
Your request is a bit topsy-turvey because a thread running on it's own and
showing activity would probably run quite happily with the UI thread crashed
or stalled.
A typical way to do this sort of task is to have the activity, which is
probably running in a loop fetching data or doing other processing, invoke a
delegate or simply call a method in the main form or a specific control on
the UI thread.
Remember that the UI runs on a particular thread and will not correctly
process method calls from other threads. The Invoke mechanism is provided to
enable some thread other than the UI thread to make method calls or adjust
properties.
For example. A form with the method UpdateProgress() would spawn a thread to
do some lengthy processing. The thread would have a reference to the form
and use Invoke to call UpdateProgress each time round it's loop.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
> Can anyone point me to a resource that describes how to spawn a thread
> that
[quoted text clipped - 9 lines]
>
> K
KMiller - 29 Sep 2005 22:47 GMT
Bob
Do you have any examples of using BeginInvoke?
I've tried creating a new thread off of the main UI thread (which opens the
new form), and in this new thread, processesing my progress bar. I'm getting
two behaviors that are strange. #1, if I use a timer to process the progress
bar, nothing happens at all. #2, if I create my own looping structure to
process the progress bar, it works, but when the new form is opened, I lose
all context and the ability to view the progress bar.. which is the original
challenge.
> Your request is a bit topsy-turvey because a thread running on it's own and
> showing activity would probably run quite happily with the UI thread crashed
[quoted text clipped - 27 lines]
> >
> > K
Lloyd Dupont - 30 Sep 2005 01:58 GMT
I have to disagree with you here.
You could have multiple UI thread. The anciliary one being run with a
ShowDialog() (instead of Application.Run()), as it is described in all
splash screen samples.
Even those from MSDN.
InvokeRequired is also inappropriate at startup time, where Aplication.Run()
has not even been called yet!
you could use a splash form even before Application.Run() ;-)
=== Warining: pseudo code below ==========
public class SplashForm : Form
{
Thread localUiThread;
public void ShowSplash()
{
if(localUiThread != null)
return;
localUiThread = new Thread(delegate() { ShowDialog(); });
localUiThread.Start();
}
public void HideSplash()
{
if(localUiThread == null)
return;
BeginInvoke(new MethodInvoker(delegate() { ThreadStop(); }));
}
void ThreadStop()
{
if(IsDisposed)
return;
Close();
}
}
KMiller - 30 Sep 2005 16:51 GMT
I'm still having a problem with my splash screen "freezing" when the new form
is instanitated and loaded. I've tried lots of things, and nothing is
working.
Here's what I'm doing:
step1) On the UIThread, create new instance of my splash screen form.
When this form loads, a progress bar begins filling back and forth.
step2) On a new thread, create an instance of the form I'm trying to load.
I'm using VB.NET, and it looks as such:
dim t as thread
t = new thread(addressof [my procedure])
t.start()
--------------
When I do this, the splash screen is visible, but the progress bar doesn't
start filling until the form I'm loading on the new thread is complete.
> I have to disagree with you here.
> You could have multiple UI thread. The anciliary one being run with a
[quoted text clipped - 31 lines]
> }
> }
Lloyd Dupont - 01 Oct 2005 00:57 GMT
You get it all wrong!!
The Splash screen is the one to be launched in an ancilary thread not your
main code!)!
please use the SplashForm I provided you and it will just work very
simply...
something like that:
main()
{
SplashForm sf = new SplashForm();
sf.Show();
MyForm f = new MyForm();
f.Show();
// do lengthy initialization stuff....
sf.HideSplash();
Application.Run(f);
}

Signature
If you're in a war, instead of throwing a hand grenade at the enemy, throw
one of those small pumpkins. Maybe it'll make everyone think how stupid war
is, and while they are thinking, you can throw a real grenade at them.
Jack Handey.
> I'm still having a problem with my splash screen "freezing" when the new
> form
[quoted text clipped - 55 lines]
>> }
>> }