🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #377

.Net Threading Question

#377
From: Arun Kumar
Date: Sat, 16 Apr 2005 13:45
82 lines
2049 bytes
What is wrong with this code. All i am trying to test is 3 progressbar and
one button. On buttonclick i create 3 threads and each thread calls a method
which in turn updates the progressbar and it works. I would to know if this
can be used.
I am using VS 2003.NET and what i see in Borland C# there are some changes 
or mappings for delegates.


Thanks
private void button1_Click(object sender, System.EventArgs e)

{

ThreadStart job = new ThreadStart(onemethod);

Thread thread = new Thread(job);

thread.Start();

ThreadStart job1 = new ThreadStart(secondmethod);

Thread thread1 = new Thread(job1);

thread1.Start();

ThreadStart job2 = new ThreadStart(thirdmethod);

Thread thread2 = new Thread(job2);

thread2.Start();



}

public void onemethod()

{

for (int i=0;i<100;i++)

{

progressBar1.Value = i;

Thread.Sleep(100);

}

}

public void secondmethod()

{

for (int i=0;i<100;i++)

{

progressBar2.Value = i;

Thread.Sleep(100);

}

}

public void thirdmethod()

{

for (int i=0;i<100;i++)

{

progressBar3.Value = i;

Thread.Sleep(100);

}

}
Technical Details
Message-ID: <42611700$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.cybernetik.net!newsfeed.cybernetik.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,8bd714934cbc8abe,start
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Arun Kumar" <arunpv@hotmail.com>
Newsgroups: borland.public.csharpbuilder.language.csharp
Subject: .Net Threading Question 
Date: Sat, 16 Apr 2005 09:45:38 -0400
Lines: 85
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 24.185.187.130
Message-ID: <42611700$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1113659136 24.185.187.130 (16 Apr 2005 06:45:36 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news-out.cybernetik.net!newsfeed.cybernetik.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail