473,320 Members | 1,713 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.

C# Screen not Refreshing during long process

I have a Simple Windows Form which I placed a button and when the button is
pressed it proceses data into a database and I update the task bar for each
record.
The task bar would show processing 1 of 200 and so on...

The problem is if I click anyware on my form during this process it locks
and I cant do anything with that form.( my process keeps running but the form
stops updateing)
Now if I dont touch the form. its happy and my task bar updates ok.

How can I keep this from happening?
I was told to use a Thread but im not sure how to this.
Can I do someing like
Thread.Start();
My process runs...
Thread.stop();

Any Ideas or can I use something else?
--
Cheers,
Craig C Dallas,TX

Jul 21 '05 #1
3 3160
On simple way is to do it asynchronously and a separate thread is one way.
Another easy way is to create a delegate that matches the signature of the
function you want to call. Then, delcare in instance of the delegate, and
use IAsyncResult ar = delegateName.BeginInvoke();//passing in null for the
addiotional parameters since you probably don't need a callback.
http://www.knowdotnet.com/articles/reponsiveui.html

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Craig C" <Cr****@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
I have a Simple Windows Form which I placed a button and when the button is pressed it proceses data into a database and I update the task bar for each record.
The task bar would show processing 1 of 200 and so on...

The problem is if I click anyware on my form during this process it locks
and I cant do anything with that form.( my process keeps running but the form stops updateing)
Now if I dont touch the form. its happy and my task bar updates ok.

How can I keep this from happening?
I was told to use a Thread but im not sure how to this.
Can I do someing like
Thread.Start();
My process runs...
Thread.stop();

Any Ideas or can I use something else?
--
Cheers,
Craig C Dallas,TX

Jul 21 '05 #2
On Fri, 29 Oct 2004 12:41:03 -0700, Craig C wrote:

Any Ideas or can I use something else?


I presume your processing occurs in a loop. The quickest, "low tech"
method of resolving your problem is to add a call to Application.DoEvents
to your loop.

This may suit your needs.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
Jul 21 '05 #3
Thanks!!! That did the job.
Craig

"Chris Dunaway" <"dunawayc[[at]_lunchmeat" wrote:
On Fri, 29 Oct 2004 12:41:03 -0700, Craig C wrote:

Any Ideas or can I use something else?


I presume your processing occurs in a loop. The quickest, "low tech"
method of resolving your problem is to add a call to Application.DoEvents
to your loop.

This may suit your needs.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.

Jul 21 '05 #4

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

Similar topics

5
by: Paula | last post by:
Is there a way to keep the browser from refreshing the screen during a post back to the same page? This is annoying when you are viewing something at the bottom of a page an the post refreshes the...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
3
by: John Baker | last post by:
Hi: As in the "Wizard of Oz", I want people to "pay no attention to the man behind the curtain", by freezing the screen while a whole lot of things happen. I know about ECHO OFF, but this...
2
by: Art | last post by:
I've got a program that I run -- it's under the control of a form. Part of the process is fairly lengthy (10 minutes). The form has a control that lets me know how far it's gotten. My problem...
3
by: Craig C | last post by:
I have a Simple Windows Form which I placed a button and when the button is pressed it proceses data into a database and I update the task bar for each record. The task bar would show processing 1...
6
by: Br | last post by:
Hi everyone, Another newbie-type question, Here's what I'd like to do: 1) Have a user type something into an input-field 2) Transfer that information into a database 3) Extract that...
6
by: Chris Moore | last post by:
I have a .NET form where I am updating a progress bar & counter. As long as the form never loses focus, everything on the form refreshs fine. But If I open another window (like Windows Explorer)...
2
by: dmartin_1 | last post by:
I'm building an application with Visual Basic 2005. The application is multi threaded. It has a record counter on the form that counts up to completion. It works fine throughout the process as...
2
by: =?Utf-8?B?d2R1ZGVr?= | last post by:
I have a website using windows integrated security, with anonymous access turned off. The site is used to query orders from a database and when the search takes a long time, a windows login box...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.