Treads in Compact Framework

G

Ghost

Hello there.
I have some problem with treads in Compact Framework.
Lets I explain what exactly :

Lets take some example:
I have start Window Application and put on it one progress bar and one
button, now I'm doing so:

private void button1_Click(object sender, System.EventArgs e)
{
Thread t = new Thread(new ThreadStart(myFunction));
t.Start();
}

private void myFunction ()
{
for (int i=0; i<=100; i++)
progressBar1.Value = i;
}

So, when I run application and click to the button the thread starts and
progress bar is filling but about 30 (or sometimes other) stage its stops
and application don't responses on any action. But when I do it not in
Compact Framework all works fine.

What can I do to solve this problem?
Can you show me some example or demo please?
 
A

Alex Yakhnin, MVP

You MUST use a Control.Invoke if you're updating the UI from a different
thread.
 
A

Anders Fredborg

Alex, could u please show an example of how to use this Control.Invoke

Thx in Advance :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top